discourse/app/assets/javascripts/admin/models/email_log.js

35 lines
708 B
JavaScript
Raw Normal View History

/**
Our data model for representing an email log.
@class EmailLog
@extends Discourse.Model
@namespace Discourse
@module Discourse
**/
Discourse.EmailLog = Discourse.Model.extend({});
Discourse.EmailLog.reopenClass({
create: function(attrs) {
2013-10-29 13:01:42 -04:00
attrs = attrs || {};
if (attrs.user) {
attrs.user = Discourse.AdminUser.create(attrs.user);
}
return this._super(attrs);
},
findAll: function(filter) {
var result = Em.A();
Discourse.ajax("/admin/email/logs.json", {
data: { filter: filter }
}).then(function(logs) {
_.each(logs,function(log) {
result.pushObject(Discourse.EmailLog.create(log));
});
});
return result;
}
});