FIX: Notifying users via flag wasn't refreshing the UX

This commit is contained in:
Robin Ward 2016-02-16 14:35:12 -05:00
parent ba203b3a94
commit 5bc1c5130e

View File

@ -89,7 +89,6 @@ export default Ember.Controller.extend(ModalFunctionality, {
}, },
createFlag(opts) { createFlag(opts) {
const self = this;
let postAction; // an instance of ActionSummary let postAction; // an instance of ActionSummary
if (!this.get('flagTopic')) { if (!this.get('flagTopic')) {
@ -103,13 +102,14 @@ export default Ember.Controller.extend(ModalFunctionality, {
this.send('hideModal'); this.send('hideModal');
postAction.act(this.get('model'), params).then(function() { postAction.act(this.get('model'), params).then(() => {
self.send('closeModal'); this.send('closeModal');
if (params.message) { if (params.message) {
self.set('message', ''); this.set('message', '');
} }
}, function(errors) { this.appEvents.trigger('post-stream:refresh', { id: this.get('model.id') });
self.send('closeModal'); }).catch(errors => {
this.send('closeModal');
if (errors && errors.responseText) { if (errors && errors.responseText) {
bootbox.alert($.parseJSON(errors.responseText).errors); bootbox.alert($.parseJSON(errors.responseText).errors);
} else { } else {