mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-25 00:29:30 -05:00
26 lines
597 B
JavaScript
26 lines
597 B
JavaScript
/**
|
|
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({
|
|
findDigest: function(lastSeenAt) {
|
|
|
|
if (Em.isEmpty(lastSeenAt)) {
|
|
lastSeenAt = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
|
}
|
|
|
|
return Discourse.ajax("/admin/email/preview-digest.json", {
|
|
data: {last_seen_at: lastSeenAt}
|
|
}).then(function (result) {
|
|
return Discourse.EmailPreview.create(result);
|
|
});
|
|
}
|
|
});
|
|
|
|
|