Reload page when dealing with mass actions on topic.

This commit is contained in:
Guo Xiang Tan 2015-09-08 21:51:06 +08:00
parent 113cb4d3ad
commit b549ed15b9
2 changed files with 7 additions and 4 deletions

View file

@ -39,11 +39,11 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
username: this.get('new_user')
};
Discourse.Topic.changeOwners(this.get('topicController.model.id'), saveOpts).then(function(result) {
Discourse.Topic.changeOwners(this.get('topicController.model.id'), saveOpts).then(function() {
// success
self.send('closeModal');
self.get('topicController').send('toggleMultiSelect');
Em.run.next(function() { DiscourseURL.routeTo(result.url); });
Em.run.next(() => { DiscourseURL.routeTo(self.get("topicController.model.url")); });
}, function() {
// failure
self.flash(I18n.t('topic.change_owner.error'), 'alert-error');

View file

@ -1,5 +1,6 @@
import ModalFunctionality from 'discourse/mixins/modal-functionality';
import computed from 'ember-addons/ember-computed-decorators';
import DiscourseURL from 'discourse/lib/url';
// Modal related to changing the timestamp of posts
export default Ember.Controller.extend(ModalFunctionality, {
@ -40,14 +41,16 @@ export default Ember.Controller.extend(ModalFunctionality, {
actions: {
changeTimestamp: function() {
this.set('saving', true);
const self = this;
const self = this,
topic = this.get('topicController.model');
Discourse.Topic.changeTimestamp(
this.get('topicController.model.id'),
topic.get('id'),
this.get('createdAt').unix()
).then(function() {
self.send('closeModal');
self.setProperties({ date: '', time: '', saving: false });
Em.run.next(() => { DiscourseURL.routeTo(topic.get('url')); });
}).catch(function() {
self.flash(I18n.t('topic.change_timestamp.error'), 'alert-error');
self.set('saving', false);