Merge pull request #3737 from tgxworld/reload_page

Reload page when dealing with mass actions on topic.
This commit is contained in:
Robin Ward 2015-09-08 16:34:38 -04:00
commit cf114f323d
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);