mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 13:35:44 +08:00
FIX: Clearing flags wasn't making topics visible again.
This commit is contained in:
parent
d1fdc66ca4
commit
3037e9adf6
@ -15,9 +15,9 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
|
|||||||
@param {Discourse.FlaggedPost} item The post whose flags we want to clear
|
@param {Discourse.FlaggedPost} item The post whose flags we want to clear
|
||||||
**/
|
**/
|
||||||
clearFlags: function(item) {
|
clearFlags: function(item) {
|
||||||
var _this = this;
|
var adminFlagsController = this;
|
||||||
item.clearFlags().then((function() {
|
item.clearFlags().then((function() {
|
||||||
_this.removeObject(item);
|
adminFlagsController.removeObject(item);
|
||||||
}), function() {
|
}), function() {
|
||||||
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
||||||
});
|
});
|
||||||
@ -30,9 +30,9 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
|
|||||||
@param {Discourse.FlaggedPost} item The post to delete
|
@param {Discourse.FlaggedPost} item The post to delete
|
||||||
**/
|
**/
|
||||||
deletePost: function(item) {
|
deletePost: function(item) {
|
||||||
var _this = this;
|
var adminFlagsController = this;
|
||||||
item.deletePost().then((function() {
|
item.deletePost().then((function() {
|
||||||
_this.removeObject(item);
|
adminFlagsController.removeObject(item);
|
||||||
}), function() {
|
}), function() {
|
||||||
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
||||||
});
|
});
|
||||||
@ -43,17 +43,13 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
|
|||||||
|
|
||||||
@property adminOldFlagsView
|
@property adminOldFlagsView
|
||||||
**/
|
**/
|
||||||
adminOldFlagsView: (function() {
|
adminOldFlagsView: Em.computed.equal('query', 'old'),
|
||||||
return this.query === 'old';
|
|
||||||
}).property('query'),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Are we viewing the 'active' view?
|
Are we viewing the 'active' view?
|
||||||
|
|
||||||
@property adminActiveFlagsView
|
@property adminActiveFlagsView
|
||||||
**/
|
**/
|
||||||
adminActiveFlagsView: (function() {
|
adminActiveFlagsView: Em.computed.equal('query', 'active')
|
||||||
return this.query === 'active';
|
|
||||||
}).property('query')
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -18,17 +18,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each content}}
|
{{#each flag in content}}
|
||||||
<tr {{bindAttr class="hiddenClass"}}>
|
<tr {{bindAttr class="hiddenClass"}}>
|
||||||
<td class='user'>{{#linkTo 'adminUser' user}}{{avatar user imageSize="small"}}{{/linkTo}}</td>
|
<td class='user'>{{#linkTo 'adminUser' flag.user}}{{avatar flag.user imageSize="small"}}{{/linkTo}}</td>
|
||||||
<td class='excerpt'>{{#if topicHidden}}<i title='{{i18n topic_statuses.invisible.help}}' class='icon icon-eye-close'></i> {{/if}}<h3><a href='{{unbound url}}'>{{title}}</a></h3><br>{{{excerpt}}}
|
<td class='excerpt'>{{#if flag.topicHidden}}<i title='{{i18n topic_statuses.invisible.help}}' class='icon icon-eye-close'></i> {{/if}}<h3><a href='{{unbound flag.url}}'>{{flag.title}}</a></h3><br>{{{flag.excerpt}}}
|
||||||
</td>
|
</td>
|
||||||
<td class='flaggers'>{{#each flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
|
<td class='flaggers'>{{#each flag.flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
|
||||||
<td class='last-flagged'>{{date lastFlagged}}</td>
|
<td class='last-flagged'>{{date flag.lastFlagged}}</td>
|
||||||
<td class='action'>
|
<td class='action'>
|
||||||
{{#if adminActiveFlagsView}}
|
{{#if adminActiveFlagsView}}
|
||||||
<button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags this}}>{{i18n admin.flags.clear}}</button>
|
<button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags flag}}>{{i18n admin.flags.clear}}</button>
|
||||||
<button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost this}}>{{i18n admin.flags.delete}}</button>
|
<button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost flag}}>{{i18n admin.flags.delete}}</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -100,9 +100,8 @@ where id in (?)"
|
|||||||
def clear
|
def clear
|
||||||
p = Post.find(params[:id])
|
p = Post.find(params[:id])
|
||||||
PostAction.clear_flags!(p, current_user.id)
|
PostAction.clear_flags!(p, current_user.id)
|
||||||
p.hidden = false
|
p.reload
|
||||||
p.hidden_reason_id = nil
|
p.unhide!
|
||||||
p.save
|
|
||||||
render nothing: true
|
render nothing: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user