UX: PM inboxes being expanded incorrectly when viewing tags. (#14478)

UX: PM inboxes being expanded incorrectly when viewing tags. (#14478)

Follow-up to 9d5da2b383765becb824a8f3ff3665abc8e527fa

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 b6e1f9a..780e0e0 100644
--- a/app/assets/javascripts/discourse/app/controllers/user-private-messages.js
+++ b/app/assets/javascripts/discourse/app/controllers/user-private-messages.js
@@ -12,7 +12,8 @@ export default Controller.extend({
 
   pmView: false,
   viewingSelf: alias("user.viewingSelf"),
-  isGroup: equal("pmView", "groups"),
+  isGroup: equal("pmView", "group"),
+  isPersonal: equal("pmView", "user"),
   group: null,
   groupFilter: alias("group.name"),
   currentPath: alias("router._router.currentPath"),
diff --git a/app/assets/javascripts/discourse/app/templates/user/messages.hbs b/app/assets/javascripts/discourse/app/templates/user/messages.hbs
index 0acbfd7..91b6578 100644
--- a/app/assets/javascripts/discourse/app/templates/user/messages.hbs
+++ b/app/assets/javascripts/discourse/app/templates/user/messages.hbs
@@ -6,7 +6,7 @@
       {{/link-to}}
     </li>
 
-    {{#unless group}}
+    {{#if isPersonal}}
       <li class="archive">
         {{#link-to "userPrivateMessages.sent" model}}
           {{i18n "user.messages.sent"}}
@@ -32,7 +32,7 @@
           {{i18n "user.messages.archive"}}
         {{/link-to}}
       </li>
-    {{/unless}}
+    {{/if}}
 
     {{#each model.groups as |group|}}
       {{#if group.has_messages}}
@@ -43,7 +43,7 @@
           {{/link-to}}
         </li>
 
-        {{#if (eq groupFilter group.name)}}
+        {{#if (and isGroup (eq groupFilter group.name))}}
           {{#if viewingSelf}}
             <li class="archive">
               {{#link-to "userPrivateMessages.groupNew" group.name class="new"}}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
index 1de9f52..ac97cb5 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js
@@ -73,6 +73,10 @@ acceptance(
     });
 
     needs.pretender((server, helper) => {
+      server.get("/tags/personal_messages/:username.json", () => {
+        return helper.response({ tags: [] });
+      });
+
       server.get("/t/13.json", () => {
         const response = { ...fixturesByUrl["/t/12/1.json"] };
         response.suggested_group_name = "awesome_group";
@@ -268,6 +272,16 @@ acceptance(
       );
     };
 
+    test("viewing messages filtered by tags", async function (assert) {
+      await visit("/u/charlie/messages/tags");
+
+      assert.equal(
+        count(".action-list li"),
+        3,
+        "it does not expand personal or group inbox"
+      );
+    });
+
     test("incoming group archive message acted by current user", async function (assert) {
       await visit("/u/charlie/messages");
 

GitHub sha: dad47818063ede797bb368d8ff16da68b6282f0e

This commit appears in #14478 which was approved by lis2. It was merged by tgxworld.