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

31 lines
660 B
Text
Raw Normal View History

import AdminUser from 'admin/models/admin-user';
const EmailLog = Discourse.Model.extend({});
EmailLog.reopenClass({
2014-02-14 18:50:08 -05:00
create: function(attrs) {
2013-10-29 13:01:42 -04:00
attrs = attrs || {};
if (attrs.user) {
attrs.user = AdminUser.create(attrs.user);
}
2014-02-14 18:50:08 -05:00
return this._super(attrs);
},
findAll: function(filter) {
2014-02-14 18:50:08 -05:00
filter = filter || {};
2014-02-14 19:17:13 -05:00
var status = filter.status || "all";
2014-02-14 18:50:08 -05:00
filter = _.omit(filter, "status");
return Discourse.ajax("/admin/email/" + status + ".json", { data: filter }).then(function(logs) {
return _.map(logs, function (log) {
return EmailLog.create(log);
});
});
}
});
export default EmailLog;