From 27b297472a2bc80a55f758a2019cf5ac000f1e7d Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 31 Mar 2021 16:08:12 +0300 Subject: [PATCH] FIX: Reload messages after a bulk operation (#12569) It did not show the updated state of the topic until user refreshed the page. --- .../discourse/app/controllers/topic-bulk-actions.js | 4 ++-- .../discourse/app/controllers/user-private-messages.js | 1 + .../javascripts/discourse/app/routes/user-private-messages.js | 4 ++++ .../javascripts/discourse/app/templates/user/messages.hbs | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js b/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js index 1b773658372..eaed7ff8630 100644 --- a/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js +++ b/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js @@ -253,7 +253,7 @@ export default Controller.extend(ModalFunctionality, { if (this.isGroup) { params.group = this.groupFilter; } - this.forEachPerformed(params, (t) => t.set("archived", true)); + this.performAndRefresh(params); }, moveMessagesToInbox() { @@ -261,7 +261,7 @@ export default Controller.extend(ModalFunctionality, { if (this.isGroup) { params.group = this.groupFilter; } - this.forEachPerformed(params, (t) => t.set("archived", false)); + this.performAndRefresh(params); }, unlistTopics() { diff --git a/app/assets/javascripts/discourse/app/controllers/user-private-messages.js b/app/assets/javascripts/discourse/app/controllers/user-private-messages.js index 4e12e561e16..222b819c772 100644 --- a/app/assets/javascripts/discourse/app/controllers/user-private-messages.js +++ b/app/assets/javascripts/discourse/app/controllers/user-private-messages.js @@ -55,6 +55,7 @@ export default Controller.extend({ @action toggleBulkSelect() { + this.selected.clear(); this.toggleProperty("bulkSelectEnabled"); }, }); diff --git a/app/assets/javascripts/discourse/app/routes/user-private-messages.js b/app/assets/javascripts/discourse/app/routes/user-private-messages.js index 49851427c3f..bedaa51e073 100644 --- a/app/assets/javascripts/discourse/app/routes/user-private-messages.js +++ b/app/assets/javascripts/discourse/app/routes/user-private-messages.js @@ -29,6 +29,10 @@ export default DiscourseRoute.extend({ }, actions: { + refresh() { + this.refresh(); + }, + willTransition: function () { this._super(...arguments); this.controllerFor("user").set("pmView", null); diff --git a/app/assets/javascripts/discourse/app/templates/user/messages.hbs b/app/assets/javascripts/discourse/app/templates/user/messages.hbs index 3c49419a649..004b58b4eba 100644 --- a/app/assets/javascripts/discourse/app/templates/user/messages.hbs +++ b/app/assets/javascripts/discourse/app/templates/user/messages.hbs @@ -60,7 +60,7 @@ {{#unless site.mobileView}} {{#if showToggleBulkSelect}} {{d-button icon="list" class="btn-default bulk-select" title="topics.bulk.toggle" action=(action "toggleBulkSelect")}} - {{bulk-select-button selected=selected}} + {{bulk-select-button selected=selected action=(route-action "refresh")}} {{/if}} {{/unless}}