mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: log topic/post deletions from staff members
This commit is contained in:
@@ -17,6 +17,8 @@ Discourse.StaffActionLog = Discourse.Model.extend({
|
||||
var formatted = "";
|
||||
formatted += this.format('email', 'email');
|
||||
formatted += this.format('admin.logs.ip_address', 'ip_address');
|
||||
formatted += this.format('admin.logs.topic_id', 'topic_id');
|
||||
formatted += this.format('admin.logs.post_id', 'post_id');
|
||||
if (!this.get('useCustomModalForDetails')) {
|
||||
formatted += this.format('admin.logs.staff_actions.new_value', 'new_value');
|
||||
formatted += this.format('admin.logs.staff_actions.previous_value', 'previous_value');
|
||||
@@ -25,7 +27,7 @@ Discourse.StaffActionLog = Discourse.Model.extend({
|
||||
if (this.get('details')) formatted += Handlebars.Utils.escapeExpression(this.get('details')) + '<br/>';
|
||||
}
|
||||
return formatted;
|
||||
}.property('ip_address', 'email'),
|
||||
}.property('ip_address', 'email', 'topic_id', 'post_id'),
|
||||
|
||||
format: function(label, propertyName) {
|
||||
if (this.get(propertyName)) {
|
||||
|
||||
@@ -280,7 +280,10 @@ Discourse.Post = Discourse.Model.extend({
|
||||
**/
|
||||
destroy: function(deletedBy) {
|
||||
this.setDeletedState(deletedBy);
|
||||
return Discourse.ajax("/posts/" + (this.get('id')), { type: 'DELETE' });
|
||||
return Discourse.ajax("/posts/" + this.get('id'), {
|
||||
data: { context: window.location.pathname },
|
||||
type: 'DELETE'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -215,7 +215,10 @@ Discourse.Topic = Discourse.Model.extend({
|
||||
'details.can_delete': false,
|
||||
'details.can_recover': true
|
||||
});
|
||||
return Discourse.ajax("/t/" + this.get('id'), { type: 'DELETE' });
|
||||
return Discourse.ajax("/t/" + this.get('id'), {
|
||||
data: { context: window.location.pathname },
|
||||
type: 'DELETE'
|
||||
});
|
||||
},
|
||||
|
||||
// Recover this topic if deleted
|
||||
|
||||
Reference in New Issue
Block a user