FIX: Clearing flags wasn't making topics visible again.

This commit is contained in:
Robin Ward 2013-05-24 16:03:20 -04:00
parent d1fdc66ca4
commit 3037e9adf6
3 changed files with 15 additions and 20 deletions

View File

@ -15,9 +15,9 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
@param {Discourse.FlaggedPost} item The post whose flags we want to clear
**/
clearFlags: function(item) {
var _this = this;
var adminFlagsController = this;
item.clearFlags().then((function() {
_this.removeObject(item);
adminFlagsController.removeObject(item);
}), function() {
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
**/
deletePost: function(item) {
var _this = this;
var adminFlagsController = this;
item.deletePost().then((function() {
_this.removeObject(item);
adminFlagsController.removeObject(item);
}), function() {
bootbox.alert(Em.String.i18n("admin.flags.error"));
});
@ -43,17 +43,13 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
@property adminOldFlagsView
**/
adminOldFlagsView: (function() {
return this.query === 'old';
}).property('query'),
adminOldFlagsView: Em.computed.equal('query', 'old'),
/**
Are we viewing the 'active' view?
@property adminActiveFlagsView
**/
adminActiveFlagsView: (function() {
return this.query === 'active';
}).property('query')
adminActiveFlagsView: Em.computed.equal('query', 'active')
});

View File

@ -18,17 +18,17 @@
</tr>
</thead>
<tbody>
{{#each content}}
{{#each flag in content}}
<tr {{bindAttr class="hiddenClass"}}>
<td class='user'>{{#linkTo 'adminUser' user}}{{avatar 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='user'>{{#linkTo 'adminUser' flag.user}}{{avatar flag.user imageSize="small"}}{{/linkTo}}</td>
<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 class='flaggers'>{{#each flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
<td class='last-flagged'>{{date lastFlagged}}</td>
<td class='flaggers'>{{#each flag.flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
<td class='last-flagged'>{{date flag.lastFlagged}}</td>
<td class='action'>
{{#if adminActiveFlagsView}}
<button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags this}}>{{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.clear_title}}' class='btn' {{action clearFlags flag}}>{{i18n admin.flags.clear}}</button>
<button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost flag}}>{{i18n admin.flags.delete}}</button>
{{/if}}
</td>
</tr>

View File

@ -100,9 +100,8 @@ where id in (?)"
def clear
p = Post.find(params[:id])
PostAction.clear_flags!(p, current_user.id)
p.hidden = false
p.hidden_reason_id = nil
p.save
p.reload
p.unhide!
render nothing: true
end
end