discourse/app/assets/javascripts/admin/models/email-preview.js.es6

24 lines
605 B
Text
Raw Normal View History

2016-06-30 13:55:44 -04:00
import { ajax } from 'discourse/lib/ajax';
const EmailPreview = Discourse.Model.extend({});
EmailPreview.reopenClass({
findDigest: function(lastSeenAt, username) {
if (Em.isEmpty(lastSeenAt)) {
lastSeenAt = moment().subtract(7, 'days').format('YYYY-MM-DD');
}
if (Em.isEmpty(username)) {
username = Discourse.User.current().username;
}
2016-06-30 13:55:44 -04:00
return ajax("/admin/email/preview-digest.json", {
data: { last_seen_at: lastSeenAt, username: username }
}).then(function (result) {
return EmailPreview.create(result);
});
}
});
export default EmailPreview;