discourse/app/assets/javascripts/admin/models/screened-email.js
Jarek Radosz 67b34600d5
DEV: Use type instead of method in ajax calls (#8974)
Even though `type` is an alias for `method`, we have custom logic in `/discourse/lib/ajax` that checks only `type`, and ~200 other ajax calls in the codebase already use `type` param.
2020-03-26 21:00:10 +01:00

31 lines
733 B
JavaScript

import discourseComputed from "discourse-common/utils/decorators";
import { ajax } from "discourse/lib/ajax";
import EmberObject from "@ember/object";
const ScreenedEmail = EmberObject.extend({
@discourseComputed("action")
actionName(action) {
return I18n.t("admin.logs.screened_actions." + action);
},
clearBlock: function() {
return ajax("/admin/logs/screened_emails/" + this.id, {
type: "DELETE"
});
}
});
ScreenedEmail.reopenClass({
findAll: function() {
return ajax("/admin/logs/screened_emails.json").then(function(
screened_emails
) {
return screened_emails.map(function(b) {
return ScreenedEmail.create(b);
});
});
}
});
export default ScreenedEmail;