Group posts adhere to prioritize name in UX option (#12789)

Displays either username or name on the group activity page.
Removes hardcoded comma, and adds classes to share padding styling
This commit is contained in:
Jeff Wong 2021-04-21 07:30:25 -10:00 committed by GitHub
parent a172a6cd9c
commit 27771ad189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
import getURL from "discourse-common/lib/get-url";
import { prioritizeNameInUx } from "discourse/lib/settings";
import { propertyEqual } from "discourse/lib/computed";
export default Component.extend({
@ -14,4 +15,12 @@ export default Component.extend({
"post.post_type",
"site.post_types.moderator_action"
),
@discourseComputed("post.user")
name() {
if (prioritizeNameInUx(this.post.user.name)) {
return this.post.user.name;
}
return this.post.user.username;
},
});

View File

@ -12,10 +12,10 @@
</span>
</div>
<div class="group-post-category">{{category-link post.category}}</div>
{{#if post.user.name}}
<div class="group-member-info">
<span class="name">{{post.user.name}}</span>
{{#if post.user.title}}<span class="title">, {{post.user.title}}</span>{{/if}}
{{#if post.user}}
<div class="group-member-info names">
<span class="name">{{name}}</span>
{{#if post.user.title}}<span class="user-title">{{post.user.title}}</span>{{/if}}
</div>
{{/if}}
</div>