FEATURE: log topic/post deletions from staff members

This commit is contained in:
Régis Hanol
2014-10-01 17:40:13 +02:00
parent be93f224a6
commit 98b6b9821a
14 changed files with 155 additions and 33 deletions

View File

@@ -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)) {

View File

@@ -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'
});
},
/**

View File

@@ -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