UX: respect "prioritize username in ux" setting wherever possible (#12357)
This commit ensures that "prioritize username in ux" setting is respected in following places: - user directory - user summary - badge detail - group detail
This commit is contained in:
parent
1aaf588fb7
commit
3eb769d03b
|
@ -2,6 +2,7 @@ import Component from "@ember/component";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
|
import { prioritizeNameInUx } from "discourse/lib/settings";
|
||||||
|
|
||||||
export function normalize(name) {
|
export function normalize(name) {
|
||||||
return name.replace(/[\-\_ \.]/g, "").toLowerCase();
|
return name.replace(/[\-\_ \.]/g, "").toLowerCase();
|
||||||
|
@ -24,4 +25,9 @@ export default Component.extend({
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@discourseComputed("user.name")
|
||||||
|
nameFirst(name) {
|
||||||
|
return prioritizeNameInUx(name);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
<div class="user-detail">
|
<div class="user-detail">
|
||||||
<div class="name-line">
|
<div class="name-line">
|
||||||
<span class="username"><a href={{this.userPath}} data-user-card={{@user.username}}>{{format-username @user.username}}</a></span>
|
<span class={{if nameFirst "name bold" "username bold"}}><a href={{this.userPath}} data-user-card={{@user.username}}>{{if nameFirst this.name (format-username @user.username)}}</a></span>
|
||||||
<span class="name">{{this.name}}</span>
|
<span class={{if nameFirst "username margin" "name margin"}}><a href={{this.userPath}} data-user-card={{@user.username}}>{{if nameFirst (format-username @user.username) this.name}}</a></span>
|
||||||
{{plugin-outlet name="after-user-name" connectorTagName="span" args=(hash user=user)}}
|
{{plugin-outlet name="after-user-name" connectorTagName="span" args=(hash user=user)}}
|
||||||
</div>
|
</div>
|
||||||
<div class="title">{{@user.title}}</div>
|
<div class="title">{{@user.title}}</div>
|
||||||
|
|
|
@ -91,7 +91,7 @@ acceptance("Group Requests", function (needs) {
|
||||||
.text()
|
.text()
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/\s+/g, " "),
|
.replace(/\s+/g, " "),
|
||||||
"eviltrout Robin Ward"
|
"Robin Ward eviltrout"
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".group-members tr:first-child td:nth-child(3)").text().trim(),
|
queryAll(".group-members tr:first-child td:nth-child(3)").text().trim(),
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
.me {
|
.me {
|
||||||
background-color: var(--highlight-low-or-medium);
|
background-color: var(--highlight-low-or-medium);
|
||||||
.username a,
|
.username a,
|
||||||
.name,
|
.name a,
|
||||||
.title,
|
.title,
|
||||||
.number,
|
.number,
|
||||||
.time-read {
|
.time-read {
|
||||||
|
|
|
@ -27,13 +27,16 @@
|
||||||
@include ellipsis;
|
@include ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.username a {
|
.bold a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: var(--primary-high-or-secondary-low);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.margin a {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name a,
|
||||||
|
.username a {
|
||||||
color: var(--primary-high-or-secondary-low);
|
color: var(--primary-high-or-secondary-low);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +65,7 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.margin a {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue