FIX: bulk "archive" and "move to inbox" for group messages was broken (#12488)

This commit is contained in:
Arpit Jalan 2021-03-23 21:34:47 +05:30 committed by GitHub
parent e477a9a47d
commit dc73aadbff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,5 @@
import { alias, empty } from "@ember/object/computed"; import { alias, empty } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import I18n from "I18n"; import I18n from "I18n";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { Promise } from "rsvp"; import { Promise } from "rsvp";
@ -95,11 +95,14 @@ addBulkButton("deleteTopics", "delete", {
// Modal for performing bulk actions on topics // Modal for performing bulk actions on topics
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
tags: null, userPrivateMessages: controller("user-private-messages"),
tags: null,
emptyTags: empty("tags"), emptyTags: empty("tags"),
categoryId: alias("model.category.id"), categoryId: alias("model.category.id"),
processedTopicCount: 0, processedTopicCount: 0,
isGroup: alias("userPrivateMessages.isGroup"),
groupFilter: alias("userPrivateMessages.groupFilter"),
onShow() { onShow() {
const topics = this.get("model.topics"); const topics = this.get("model.topics");
@ -246,15 +249,19 @@ export default Controller.extend(ModalFunctionality, {
}, },
archiveMessages() { archiveMessages() {
this.forEachPerformed({ type: "archive_messages" }, (t) => let params = { type: "archive_messages" };
t.set("archived", true) if (this.isGroup) {
); params.group = this.groupFilter;
}
this.forEachPerformed(params, (t) => t.set("archived", true));
}, },
moveMessagesToInbox() { moveMessagesToInbox() {
this.forEachPerformed({ type: "move_messages_to_inbox" }, (t) => let params = { type: "move_messages_to_inbox" };
t.set("archived", false) if (this.isGroup) {
); params.group = this.groupFilter;
}
this.forEachPerformed(params, (t) => t.set("archived", false));
}, },
unlistTopics() { unlistTopics() {