UX: Don't display group messages link for group with no messages. (#14453)

UX: Don’t display group messages link for group with no messages. (#14453)

diff --git a/app/assets/javascripts/discourse/app/controllers/group.js b/app/assets/javascripts/discourse/app/controllers/group.js
index 416bf58..5ef10c8 100644
--- a/app/assets/javascripts/discourse/app/controllers/group.js
+++ b/app/assets/javascripts/discourse/app/controllers/group.js
@@ -87,12 +87,16 @@ export default Controller.extend({
     return defaultTabs;
   },
 
-  @discourseComputed("model.is_group_user")
-  showMessages(isGroupUser) {
+  @discourseComputed("model.has_messages", "model.is_group_user")
+  showMessages(hasMessages, isGroupUser) {
     if (!this.siteSettings.enable_personal_messages) {
       return false;
     }
 
+    if (!hasMessages) {
+      return false;
+    }
+
     return isGroupUser || (this.currentUser && this.currentUser.admin);
   },
 
diff --git a/app/assets/javascripts/discourse/tests/fixtures/group-fixtures.js b/app/assets/javascripts/discourse/tests/fixtures/group-fixtures.js
index daf72a6..15c520a 100644
--- a/app/assets/javascripts/discourse/tests/fixtures/group-fixtures.js
+++ b/app/assets/javascripts/discourse/tests/fixtures/group-fixtures.js
@@ -1317,6 +1317,7 @@ export default {
       user_count: 8,
       alias_level: 99,
       visible: true,
+      has_messages: true,
       public_admission: true,
       public_exit: false,
       flair_url: "fa-adjust",

GitHub sha: 9998090e5b045d3acedf09820585eef198b915b4

This commit appears in #14453 which was approved by OsamaSayegh. It was merged by tgxworld.