mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
fe5264f9e9
adds a user prompt on the email digest preview page to generate a preview for a particular user also fixes some broken styling on the page
29 lines
718 B
JavaScript
29 lines
718 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, username) {
|
|
|
|
if (Em.isEmpty(lastSeenAt)) {
|
|
lastSeenAt = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
|
}
|
|
|
|
if (Em.isEmpty(username)) {
|
|
username = Discourse.User.current().username;
|
|
}
|
|
|
|
return Discourse.ajax("/admin/email/preview-digest.json", {
|
|
data: { last_seen_at: lastSeenAt, username: username }
|
|
}).then(function (result) {
|
|
return Discourse.EmailPreview.create(result);
|
|
});
|
|
}
|
|
});
|