mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 01:24:34 +08:00
c0b277d273
This change is discussed here: https://meta.discourse.org/t/deprecating-es6-compatibility-layer/35821 Prior to this change we were not booting correctly with DISCOURSE_NO_CONSTANTS
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
const ScreenedIpAddress = Discourse.Model.extend({
|
|
actionName: function() {
|
|
return I18n.t("admin.logs.screened_ips.actions." + this.get('action_name'));
|
|
}.property('action_name'),
|
|
|
|
isBlocked: function() {
|
|
return (this.get('action_name') === 'block');
|
|
}.property('action_name'),
|
|
|
|
actionIcon: function() {
|
|
return (this.get('action_name') === 'block') ? 'ban' : 'check';
|
|
}.property('action_name'),
|
|
|
|
save: function() {
|
|
return Discourse.ajax("/admin/logs/screened_ip_addresses" + (this.id ? '/' + this.id : '') + ".json", {
|
|
type: this.id ? 'PUT' : 'POST',
|
|
data: {ip_address: this.get('ip_address'), action_name: this.get('action_name')}
|
|
});
|
|
},
|
|
|
|
destroy: function() {
|
|
return Discourse.ajax("/admin/logs/screened_ip_addresses/" + this.get('id') + ".json", {type: 'DELETE'});
|
|
}
|
|
});
|
|
|
|
ScreenedIpAddress.reopenClass({
|
|
findAll: function(filter) {
|
|
return Discourse.ajax("/admin/logs/screened_ip_addresses.json", { data: { filter: filter } }).then(function(screened_ips) {
|
|
return screened_ips.map(function(b) {
|
|
return ScreenedIpAddress.create(b);
|
|
});
|
|
});
|
|
},
|
|
|
|
rollUp: function() {
|
|
return Discourse.ajax("/admin/logs/screened_ip_addresses/roll_up", { type: "POST" });
|
|
}
|
|
});
|
|
|
|
export default ScreenedIpAddress;
|