UX: Improve copy when a group member search returns no results (#13899)

UX: Improve copy when a group member search returns no results (#13899)

Previously it would say “There are no members in this group”. Now it says “No members match that search.”

Group username search empty-search message is wrong - ux - Discourse Meta

diff --git a/app/assets/javascripts/discourse/app/controllers/group-index.js b/app/assets/javascripts/discourse/app/controllers/group-index.js
index 847fdce..a15d1f8 100644
--- a/app/assets/javascripts/discourse/app/controllers/group-index.js
+++ b/app/assets/javascripts/discourse/app/controllers/group-index.js
@@ -83,6 +83,17 @@ export default Controller.extend({
     }
   },
 
+  @discourseComputed("filter", "members", "model.can_see_members")
+  emptyMessageKey(filter, members, canSeeMembers) {
+    if (!canSeeMembers) {
+      return "groups.members.forbidden";
+    } else if (filter) {
+      return "groups.members.no_filter_matches";
+    } else {
+      return "groups.empty.members";
+    }
+  },
+
   @action
   loadMore() {
     this.findMembers();
diff --git a/app/assets/javascripts/discourse/app/templates/group-index.hbs b/app/assets/javascripts/discourse/app/templates/group-index.hbs
index dd07e01..8915449 100644
--- a/app/assets/javascripts/discourse/app/templates/group-index.hbs
+++ b/app/assets/javascripts/discourse/app/templates/group-index.hbs
@@ -111,13 +111,9 @@
     {{/load-more}}
 
     {{conditional-loading-spinner condition=loading}}
-  {{else if model.can_see_members}}
-    <br>
-
-    <div>{{i18n "groups.empty.members"}}</div>
   {{else}}
     <br>
 
-    <div>{{i18n "groups.members.forbidden"}}</div>
+    <div>{{i18n emptyMessageKey}}</div>
   {{/if}}
 </section>
diff --git a/app/assets/javascripts/discourse/app/templates/mobile/group-index.hbs b/app/assets/javascripts/discourse/app/templates/mobile/group-index.hbs
index a0c6c8c..1da7312 100644
--- a/app/assets/javascripts/discourse/app/templates/mobile/group-index.hbs
+++ b/app/assets/javascripts/discourse/app/templates/mobile/group-index.hbs
@@ -49,13 +49,9 @@
     {{/load-more}}
 
     {{conditional-loading-spinner condition=loading}}
-  {{else if model.can_see_members}}
-    <br>
-
-    <div>{{i18n "groups.empty.members"}}</div>
   {{else}}
     <br>
 
-    <div>{{i18n "groups.members.forbidden"}}</div>
+    <div>{{i18n emptyMessageKey}}</div>
   {{/if}}
 </section>
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index ad39498..8a42f74 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -850,6 +850,7 @@ en:
         owner: "Owner"
         primary: "Primary"
         forbidden: "You're not allowed to view the members."
+        no_filter_matches: "No members match that search."
       topics: "Topics"
       posts: "Posts"
       mentions: "Mentions"

GitHub sha: ccf1cd0ca6670fe30a4aa23641cae21564aef708

This commit appears in #13899 which was approved by CvX. It was merged by davidtaylorhq.