From 4886c1fddc5fcd2080855f2277c2125ecf3af7d2 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:26:40 -0700 Subject: [PATCH] DEV: Update when / how we display of full name on `search-item-user` (#25090) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Full name should only be displayed within `initial options` - Keep results on a single line unless full name is included # Initial Options Screenshot 2024-01-02 at 9 58 07 AM # Other Screenshot 2024-01-02 at 9 58 43 AM Screenshot 2024-01-02 at 9 58 18 AM --- .../discourse/app/components/search-menu/results.hbs | 1 + .../app/components/search-menu/results/type/user.hbs | 2 +- .../app/components/search-menu/results/types.hbs | 5 ++++- .../discourse/tests/acceptance/glimmer-search-test.js | 3 --- app/assets/stylesheets/common/base/search-menu.scss | 9 ++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/search-menu/results.hbs b/app/assets/javascripts/discourse/app/components/search-menu/results.hbs index 2d666379085..6cfec455484 100644 --- a/app/assets/javascripts/discourse/app/components/search-menu/results.hbs +++ b/app/assets/javascripts/discourse/app/components/search-menu/results.hbs @@ -62,6 +62,7 @@ @resultTypes={{this.resultTypesWithComponent}} @closeSearchMenu={{@closeSearchMenu}} @searchTermChanged={{@searchTermChanged}} + @displayNameWithUser={{true}} /> {{/if}} {{/if}} diff --git a/app/assets/javascripts/discourse/app/components/search-menu/results/type/user.hbs b/app/assets/javascripts/discourse/app/components/search-menu/results/type/user.hbs index 731df825b3e..d6a9a070ad3 100644 --- a/app/assets/javascripts/discourse/app/components/search-menu/results/type/user.hbs +++ b/app/assets/javascripts/discourse/app/components/search-menu/results/type/user.hbs @@ -5,7 +5,7 @@ username=@result.username }}
- {{#if @result.name}} + {{#if (and @displayNameWithUser @result.name)}} {{@result.name}} {{/if}} diff --git a/app/assets/javascripts/discourse/app/components/search-menu/results/types.hbs b/app/assets/javascripts/discourse/app/components/search-menu/results/types.hbs index 72943c92f2a..2c9660a994b 100644 --- a/app/assets/javascripts/discourse/app/components/search-menu/results/types.hbs +++ b/app/assets/javascripts/discourse/app/components/search-menu/results/types.hbs @@ -17,7 +17,10 @@ {{on "click" this.onClick}} class="search-link" > - + {{/each}} diff --git a/app/assets/javascripts/discourse/tests/acceptance/glimmer-search-test.js b/app/assets/javascripts/discourse/tests/acceptance/glimmer-search-test.js index 9b868b310fb..f12cb72c377 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/glimmer-search-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/glimmer-search-test.js @@ -1136,9 +1136,6 @@ acceptance("Search - Glimmer - assistant", function (needs) { const username = firstUser.querySelector(".username").innerText.trim(); assert.strictEqual(username, "TeaMoe"); - const name = firstUser.querySelector(".name").innerText.trim(); - assert.strictEqual(name, "TeaMoe Full"); - await click(firstUser); assert.strictEqual(query("#search-term").value, `@${username}`); }); diff --git a/app/assets/stylesheets/common/base/search-menu.scss b/app/assets/stylesheets/common/base/search-menu.scss index 7fb1f3dee86..48bfffa8657 100644 --- a/app/assets/stylesheets/common/base/search-menu.scss +++ b/app/assets/stylesheets/common/base/search-menu.scss @@ -387,12 +387,11 @@ $search-pad-horizontal: 0.5em; } .search-item-user { - .username { - margin-right: 0.33rem; - } + display: flex; + align-self: center; - img.avatar { - margin-right: 0 !important; + .username { + margin-right: 0.33em; } }