2013-02-23 04:41:12 +08:00
|
|
|
/**
|
|
|
|
Our data model for representing an email log.
|
2013-02-21 02:15:50 +08:00
|
|
|
|
2013-03-06 04:39:21 +08:00
|
|
|
@class EmailLog
|
2013-02-23 04:41:12 +08:00
|
|
|
@extends Discourse.Model
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-06 04:39:21 +08:00
|
|
|
**/
|
2013-02-23 04:41:12 +08:00
|
|
|
Discourse.EmailLog = Discourse.Model.extend({});
|
2013-02-22 03:09:28 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
Discourse.EmailLog.reopenClass({
|
2014-02-15 07:50:08 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
create: function(attrs) {
|
2013-10-30 01:01:42 +08:00
|
|
|
attrs = attrs || {};
|
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
if (attrs.user) {
|
|
|
|
attrs.user = Discourse.AdminUser.create(attrs.user);
|
|
|
|
}
|
2014-02-15 07:50:08 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
return this._super(attrs);
|
|
|
|
},
|
2013-02-22 03:09:28 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
findAll: function(filter) {
|
2014-02-15 07:50:08 +08:00
|
|
|
filter = filter || {};
|
2014-02-15 08:17:13 +08:00
|
|
|
var status = filter.status || "all";
|
2014-02-15 07:50:08 +08:00
|
|
|
filter = _.omit(filter, "status");
|
|
|
|
|
|
|
|
return Discourse.ajax("/admin/email/" + status + ".json", { data: filter }).then(function(logs) {
|
|
|
|
return _.map(logs, function (log) {
|
|
|
|
return Discourse.EmailLog.create(log);
|
2013-04-04 04:06:55 +08:00
|
|
|
});
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2013-02-22 03:09:28 +08:00
|
|
|
|
2013-02-21 02:15:50 +08:00
|
|
|
|