The ability to display errors on flagging actions.

This commit is contained in:
Robin Ward
2017-09-23 10:39:58 -04:00
parent e809996c2a
commit d1ebc62065
7 changed files with 50 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
import { ajax } from 'discourse/lib/ajax';
import Post from 'discourse/models/post';
import computed from 'ember-addons/ember-computed-decorators';
import { popupAjaxError } from 'discourse/lib/ajax-error';
export default Post.extend({
@@ -52,15 +53,15 @@ export default Post.extend({
},
disagreeFlags() {
return ajax('/admin/flags/disagree/' + this.id, { type: 'POST', cache: false });
return ajax('/admin/flags/disagree/' + this.id, { type: 'POST', cache: false }).catch(popupAjaxError);
},
deferFlags(deletePost) {
return ajax('/admin/flags/defer/' + this.id, { type: 'POST', cache: false, data: { delete_post: deletePost } });
return ajax('/admin/flags/defer/' + this.id, { type: 'POST', cache: false, data: { delete_post: deletePost } }).catch(popupAjaxError);
},
agreeFlags(actionOnPost) {
return ajax('/admin/flags/agree/' + this.id, { type: 'POST', cache: false, data: { action_on_post: actionOnPost } });
return ajax('/admin/flags/agree/' + this.id, { type: 'POST', cache: false, data: { action_on_post: actionOnPost } }).catch(popupAjaxError);
},
postHidden: Ember.computed.alias('hidden'),

View File

@@ -153,5 +153,9 @@
{{/unless}}
</div>
{{/if}}
{{plugin-outlet
name="flagged-post-below-controls"
tagName=""
args=(hash flaggedPost=flaggedPost canAct=canAct)}}
</div>
</div>