DEV: Update when / how we display of full name on `search-item-user` (#25090)

- Full name should only be displayed within `initial options`
- Keep results on a single line unless full name is included

# Initial Options
<img width="416" alt="Screenshot 2024-01-02 at 9 58 07 AM" src="https://github.com/discourse/discourse/assets/50783505/a9f6880a-86e0-4683-978a-c0391a90c78e">

# Other
<img width="432" alt="Screenshot 2024-01-02 at 9 58 43 AM" src="https://github.com/discourse/discourse/assets/50783505/83b508b0-c501-4fb7-89f7-8e66dc88979f">
<img width="424" alt="Screenshot 2024-01-02 at 9 58 18 AM" src="https://github.com/discourse/discourse/assets/50783505/b98223d7-f92c-4803-87bf-0470e6ce05ed">
This commit is contained in:
Isaac Janzen 2024-01-02 10:26:40 -07:00 committed by GitHub
parent 8e1fc93748
commit 4886c1fddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -62,6 +62,7 @@
@resultTypes={{this.resultTypesWithComponent}} @resultTypes={{this.resultTypesWithComponent}}
@closeSearchMenu={{@closeSearchMenu}} @closeSearchMenu={{@closeSearchMenu}}
@searchTermChanged={{@searchTermChanged}} @searchTermChanged={{@searchTermChanged}}
@displayNameWithUser={{true}}
/> />
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -5,7 +5,7 @@
username=@result.username username=@result.username
}} }}
<div class="user-titles"> <div class="user-titles">
{{#if @result.name}} {{#if (and @displayNameWithUser @result.name)}}
<span class="name">{{@result.name}}</span> <span class="name">{{@result.name}}</span>
{{/if}} {{/if}}
<span class="username"> <span class="username">

View File

@ -17,7 +17,10 @@
{{on "click" this.onClick}} {{on "click" this.onClick}}
class="search-link" class="search-link"
> >
<resultType.component @result={{result}} /> <resultType.component
@result={{result}}
@displayNameWithUser={{@displayNameWithUser}}
/>
</a> </a>
</li> </li>
{{/each}} {{/each}}

View File

@ -1136,9 +1136,6 @@ acceptance("Search - Glimmer - assistant", function (needs) {
const username = firstUser.querySelector(".username").innerText.trim(); const username = firstUser.querySelector(".username").innerText.trim();
assert.strictEqual(username, "TeaMoe"); assert.strictEqual(username, "TeaMoe");
const name = firstUser.querySelector(".name").innerText.trim();
assert.strictEqual(name, "TeaMoe Full");
await click(firstUser); await click(firstUser);
assert.strictEqual(query("#search-term").value, `@${username}`); assert.strictEqual(query("#search-term").value, `@${username}`);
}); });

View File

@ -387,12 +387,11 @@ $search-pad-horizontal: 0.5em;
} }
.search-item-user { .search-item-user {
.username { display: flex;
margin-right: 0.33rem; align-self: center;
}
img.avatar { .username {
margin-right: 0 !important; margin-right: 0.33em;
} }
} }