2013-02-21 02:15:50 +08:00
|
|
|
(function() {
|
|
|
|
|
2013-02-22 03:09:28 +08:00
|
|
|
/**
|
|
|
|
Our data model for representing an email log.
|
|
|
|
|
|
|
|
@class EmailLog
|
|
|
|
@extends Discourse.Model
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
2013-02-21 02:15:50 +08:00
|
|
|
window.Discourse.EmailLog = Discourse.Model.extend({});
|
|
|
|
|
|
|
|
window.Discourse.EmailLog.reopenClass({
|
2013-02-22 03:09:28 +08:00
|
|
|
|
2013-02-21 02:15:50 +08:00
|
|
|
create: function(attrs) {
|
|
|
|
if (attrs.user) {
|
|
|
|
attrs.user = Discourse.AdminUser.create(attrs.user);
|
|
|
|
}
|
|
|
|
return this._super(attrs);
|
|
|
|
},
|
2013-02-22 03:09:28 +08:00
|
|
|
|
2013-02-21 02:15:50 +08:00
|
|
|
findAll: function(filter) {
|
|
|
|
var result;
|
|
|
|
result = Em.A();
|
|
|
|
jQuery.ajax({
|
|
|
|
url: "/admin/email_logs.json",
|
2013-02-22 03:09:28 +08:00
|
|
|
data: { filter: filter },
|
2013-02-21 02:15:50 +08:00
|
|
|
success: function(logs) {
|
2013-02-22 03:09:28 +08:00
|
|
|
logs.each(function(log) {
|
|
|
|
result.pushObject(Discourse.EmailLog.create(log));
|
2013-02-21 02:15:50 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}).call(this);
|