mirror of
https://github.com/discourse/discourse.git
synced 2025-06-08 00:27:32 +08:00
FIX: Add missing user search result name
and styling (#24974)
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
This commit is contained in:
@ -4,11 +4,16 @@
|
|||||||
template=@result.avatar_template
|
template=@result.avatar_template
|
||||||
username=@result.username
|
username=@result.username
|
||||||
}}
|
}}
|
||||||
<span class="username">
|
<div class="user-titles">
|
||||||
|
{{#if @result.name}}
|
||||||
|
<span class="name">{{@result.name}}</span>
|
||||||
|
{{/if}}
|
||||||
|
<span class="username">
|
||||||
{{format-username @result.username}}
|
{{format-username @result.username}}
|
||||||
</span>
|
</span>
|
||||||
{{#if @result.custom_data}}
|
{{#if @result.custom_data}}
|
||||||
{{#each @result.custom_data as |row|}}
|
{{#each @result.custom_data as |row|}}
|
||||||
<span class="custom-field">{{row.name}}: {{row.value}}</span>
|
<span class="custom-field">{{row.name}}: {{row.value}}</span>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</div>
|
@ -1040,7 +1040,7 @@ acceptance("Search - Glimmer - assistant", function (needs) {
|
|||||||
users: [
|
users: [
|
||||||
{
|
{
|
||||||
username: "TeaMoe",
|
username: "TeaMoe",
|
||||||
name: "TeaMoe",
|
name: "TeaMoe Full",
|
||||||
avatar_template:
|
avatar_template:
|
||||||
"https://avatars.discourse.org/v3/letter/t/41988e/{size}.png",
|
"https://avatars.discourse.org/v3/letter/t/41988e/{size}.png",
|
||||||
},
|
},
|
||||||
@ -1107,14 +1107,17 @@ acceptance("Search - Glimmer - assistant", function (needs) {
|
|||||||
await visit("/");
|
await visit("/");
|
||||||
await click("#search-button");
|
await click("#search-button");
|
||||||
await fillIn("#search-term", "@");
|
await fillIn("#search-term", "@");
|
||||||
const firstUser =
|
const firstUser = query(
|
||||||
".search-menu .results ul.search-menu-assistant .search-item-user";
|
".search-menu .results ul.search-menu-assistant .search-item-user"
|
||||||
const firstUsername = query(firstUser).innerText.trim();
|
);
|
||||||
|
const username = firstUser.querySelector(".username").innerText.trim();
|
||||||
|
assert.strictEqual(username, "TeaMoe");
|
||||||
|
|
||||||
assert.strictEqual(firstUsername, "TeaMoe");
|
const name = firstUser.querySelector(".name").innerText.trim();
|
||||||
|
assert.strictEqual(name, "TeaMoe Full");
|
||||||
|
|
||||||
await click(query(firstUser));
|
await click(firstUser);
|
||||||
assert.strictEqual(query("#search-term").value, `@${firstUsername}`);
|
assert.strictEqual(query("#search-term").value, `@${username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("initial options - topic search scope - selecting a tag defaults to searching 'in all topics'", async function (assert) {
|
test("initial options - topic search scope - selecting a tag defaults to searching 'in all topics'", async function (assert) {
|
||||||
|
@ -395,4 +395,38 @@ $search-pad-horizontal: 0.5em;
|
|||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-result-user {
|
||||||
|
.search-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
img.avatar {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-titles {
|
||||||
|
@include user-item-flex;
|
||||||
|
|
||||||
|
.username,
|
||||||
|
.name {
|
||||||
|
@include ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.username,
|
||||||
|
.name,
|
||||||
|
.custom-field {
|
||||||
|
color: var(--primary-high-or-secondary-low);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-field {
|
||||||
|
font-size: var(--font-down-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user