Skip to content

Commit

Permalink
FIX: bulk "archive" and "move to inbox" for group messages was broken (
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitjalan committed Mar 23, 2021
1 parent e477a9a commit dc73aad
Showing 1 changed file with 15 additions and 8 deletions.
@@ -1,5 +1,5 @@
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 ModalFunctionality from "discourse/mixins/modal-functionality";
import { Promise } from "rsvp";
Expand Down Expand Up @@ -95,11 +95,14 @@ addBulkButton("deleteTopics", "delete", {

// Modal for performing bulk actions on topics
export default Controller.extend(ModalFunctionality, {
tags: null,
userPrivateMessages: controller("user-private-messages"),

tags: null,
emptyTags: empty("tags"),
categoryId: alias("model.category.id"),
processedTopicCount: 0,
isGroup: alias("userPrivateMessages.isGroup"),
groupFilter: alias("userPrivateMessages.groupFilter"),

onShow() {
const topics = this.get("model.topics");
Expand Down Expand Up @@ -246,15 +249,19 @@ export default Controller.extend(ModalFunctionality, {
},

archiveMessages() {
this.forEachPerformed({ type: "archive_messages" }, (t) =>
t.set("archived", true)
);
let params = { type: "archive_messages" };
if (this.isGroup) {
params.group = this.groupFilter;
}
this.forEachPerformed(params, (t) => t.set("archived", true));
},

moveMessagesToInbox() {
this.forEachPerformed({ type: "move_messages_to_inbox" }, (t) =>
t.set("archived", false)
);
let params = { type: "move_messages_to_inbox" };
if (this.isGroup) {
params.group = this.groupFilter;
}
this.forEachPerformed(params, (t) => t.set("archived", false));
},

unlistTopics() {
Expand Down

2 comments on commit dc73aad

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/bulk-archive-of-group-pms-doesnt-work/183972/7

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/mass-archiving-moderator-private-messages-doesnt-archive-them/184368/4

Please sign in to comment.