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