UX: Use a different JIT message when there are no search results in the users directory (#27009)
This commit adds a different message to the users directory (`/u`) that's shown when there are no results for the search term instead of showing the one for when there are no users on the site yet. Internal topic: t/126076.
This commit is contained in:
parent
941d0f1cf5
commit
722d694305
|
@ -80,13 +80,17 @@
|
||||||
<div class="empty-state">
|
<div class="empty-state">
|
||||||
<div class="empty-state-body">
|
<div class="empty-state-body">
|
||||||
<p>
|
<p>
|
||||||
{{i18n "directory.no_results.body"}}
|
{{#if this.name}}
|
||||||
{{#if this.currentUser.staff}}
|
{{i18n "directory.no_results_with_search"}}
|
||||||
{{html-safe
|
{{else}}
|
||||||
(i18n
|
{{i18n "directory.no_results.body"}}
|
||||||
"directory.no_results.extra_body" basePath=(base-path)
|
{{#if this.currentUser.staff}}
|
||||||
)
|
{{html-safe
|
||||||
}}
|
(i18n
|
||||||
|
"directory.no_results.extra_body" basePath=(base-path)
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
queryAll,
|
queryAll,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
acceptance("User Directory", function () {
|
acceptance("User Directory", function () {
|
||||||
test("Visit Page", async function (assert) {
|
test("Visit Page", async function (assert) {
|
||||||
|
@ -93,6 +94,46 @@ acceptance("User Directory", function () {
|
||||||
"list has been sorted"
|
"list has been sorted"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Visit with no users", async function (assert) {
|
||||||
|
pretender.get("/directory_items", () => {
|
||||||
|
return response({
|
||||||
|
directory_items: [],
|
||||||
|
meta: {
|
||||||
|
last_updated_at: "2024-05-13T18:42:32.000Z",
|
||||||
|
total_rows_directory_items: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await visit("/u");
|
||||||
|
|
||||||
|
assert
|
||||||
|
.dom(".empty-state-body")
|
||||||
|
.hasText(
|
||||||
|
I18n.t("directory.no_results.body"),
|
||||||
|
"a JIT message is shown when there are no users"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Visit with no search results", async function (assert) {
|
||||||
|
pretender.get("/directory_items", () => {
|
||||||
|
return response({
|
||||||
|
directory_items: [],
|
||||||
|
meta: {
|
||||||
|
last_updated_at: "2024-05-13T18:42:32.000Z",
|
||||||
|
total_rows_directory_items: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await visit("/u?name=somenamethatdoesnotexist");
|
||||||
|
|
||||||
|
assert
|
||||||
|
.dom(".empty-state-body")
|
||||||
|
.hasText(
|
||||||
|
I18n.t("directory.no_results_with_search"),
|
||||||
|
"a different JIT message is used when there are no results for the search term"
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
acceptance("User directory - Editing columns", function (needs) {
|
acceptance("User directory - Editing columns", function (needs) {
|
||||||
|
|
|
@ -768,6 +768,7 @@ en:
|
||||||
no_results:
|
no_results:
|
||||||
body: "A list of community members showing their activity will be shown here. For now the list is empty because your community is still brand new!"
|
body: "A list of community members showing their activity will be shown here. For now the list is empty because your community is still brand new!"
|
||||||
extra_body: "Admins and moderators can see and manage users in <a href='%{basePath}/admin/users/'>User Admin</a>."
|
extra_body: "Admins and moderators can see and manage users in <a href='%{basePath}/admin/users/'>User Admin</a>."
|
||||||
|
no_results_with_search: "No results were found."
|
||||||
days_visited: "Visits"
|
days_visited: "Visits"
|
||||||
days_visited_long: "Days Visited"
|
days_visited_long: "Days Visited"
|
||||||
posts_read: "Read"
|
posts_read: "Read"
|
||||||
|
|
Loading…
Reference in New Issue