2013-06-03 16:12:24 -04:00
|
|
|
/**
|
|
|
|
Our data model for showing a preview of an email
|
|
|
|
|
|
|
|
@class EmailPreview
|
|
|
|
@extends Discourse.Model
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
|
|
|
Discourse.EmailPreview = Discourse.Model.extend({});
|
|
|
|
|
|
|
|
Discourse.EmailPreview.reopenClass({
|
2014-01-06 10:18:20 -05:00
|
|
|
findDigest: function(lastSeenAt) {
|
|
|
|
|
|
|
|
if (Em.isEmpty(lastSeenAt)) {
|
|
|
|
lastSeenAt = moment().subtract('days',7).format('YYYY-MM-DD');
|
|
|
|
}
|
|
|
|
|
2013-11-30 21:30:41 -05:00
|
|
|
return Discourse.ajax("/admin/email/preview-digest.json", {
|
2014-01-06 10:18:20 -05:00
|
|
|
data: {last_seen_at: lastSeenAt}
|
2013-06-03 16:12:24 -04:00
|
|
|
}).then(function (result) {
|
|
|
|
return Discourse.EmailPreview.create(result);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|