2013-06-04 04:12:24 +08: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 23:18:20 +08:00
|
|
|
findDigest: function(lastSeenAt) {
|
|
|
|
|
|
|
|
if (Em.isEmpty(lastSeenAt)) {
|
|
|
|
lastSeenAt = moment().subtract('days',7).format('YYYY-MM-DD');
|
|
|
|
}
|
|
|
|
|
2013-12-01 10:30:41 +08:00
|
|
|
return Discourse.ajax("/admin/email/preview-digest.json", {
|
2014-01-06 23:18:20 +08:00
|
|
|
data: {last_seen_at: lastSeenAt}
|
2013-06-04 04:12:24 +08:00
|
|
|
}).then(function (result) {
|
|
|
|
return Discourse.EmailPreview.create(result);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|