mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FIX: allow staff members to restore withdrawn posts that are flagged
This commit is contained in:
@@ -2,37 +2,25 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
|
||||
needs: ["adminFlags"],
|
||||
|
||||
_agreeFlag: function (actionOnPost) {
|
||||
var adminFlagController = this.get("controllers.adminFlags");
|
||||
var post = this.get("content");
|
||||
var self = this;
|
||||
|
||||
return post.agreeFlags(actionOnPost).then(function () {
|
||||
adminFlagController.removeObject(post);
|
||||
self.send("closeModal");
|
||||
}, function () {
|
||||
bootbox.alert(I18n.t("admin.flags.error"));
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
||||
agreeFlagHidePost: function () {
|
||||
var adminFlagController = this.get("controllers.adminFlags");
|
||||
var post = this.get("content");
|
||||
var self = this;
|
||||
|
||||
return post.agreeFlags("hide").then(function () {
|
||||
adminFlagController.removeObject(post);
|
||||
self.send("closeModal");
|
||||
}, function () {
|
||||
bootbox.alert(I18n.t("admin.flags.error"));
|
||||
});
|
||||
},
|
||||
|
||||
agreeFlagKeepPost: function () {
|
||||
var adminFlagController = this.get("controllers.adminFlags");
|
||||
var post = this.get("content");
|
||||
var self = this;
|
||||
|
||||
return post.agreeFlags("keep").then(function () {
|
||||
adminFlagController.removeObject(post);
|
||||
self.send("closeModal");
|
||||
}, function () {
|
||||
bootbox.alert(I18n.t("admin.flags.error"));
|
||||
});
|
||||
}
|
||||
|
||||
agreeFlagHidePost: function () { return this._agreeFlag("hide"); },
|
||||
agreeFlagKeepPost: function () { return this._agreeFlag("keep"); },
|
||||
agreeFlagRestorePost: function () { return this._agreeFlag("restore"); }
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{{#unless postHidden}}
|
||||
<button title="{{i18n admin.flags.agree_flag_hide_post_title}}" {{action agreeFlagHidePost}} class="btn"><i class="fa fa-thumbs-o-up"></i><i class="fa fa-eye-slash"></i>{{i18n admin.flags.agree_flag_hide_post}}</button>
|
||||
{{/unless}}
|
||||
{{#if user_deleted}}
|
||||
<button title="{{i18n admin.flags.agree_flag_restore_post_title}}" {{action agreeFlagRestorePost}} class="btn"><i class="fa fa-thumbs-o-up"></i><i class="fa fa-eye"></i>{{i18n admin.flags.agree_flag_restore_post}}</button>
|
||||
{{else}}
|
||||
{{#unless postHidden}}
|
||||
<button title="{{i18n admin.flags.agree_flag_hide_post_title}}" {{action agreeFlagHidePost}} class="btn"><i class="fa fa-thumbs-o-up"></i><i class="fa fa-eye-slash"></i>{{i18n admin.flags.agree_flag_hide_post}}</button>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
<button title="{{i18n admin.flags.agree_flag_title}}" {{action agreeFlagKeepPost}} class="btn"><i class="fa fa-thumbs-o-up"></i>{{i18n admin.flags.agree_flag}}</button>
|
||||
{{#if canDeleteAsSpammer}}
|
||||
<button title="{{i18n admin.flags.delete_spammer_title}}" {{action deleteSpammer user}} class="btn btn-danger"><i class="fa fa-exclamation-triangle"></i>{{i18n admin.flags.delete_spammer}}</button>
|
||||
|
||||
Reference in New Issue
Block a user