From 27771ad1895903cf9d4e1db997d5448c123b12d1 Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Wed, 21 Apr 2021 07:30:25 -1000 Subject: [PATCH] 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 --- .../javascripts/discourse/app/components/group-post.js | 9 +++++++++ .../discourse/app/templates/components/group-post.hbs | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/group-post.js b/app/assets/javascripts/discourse/app/components/group-post.js index 47c6a5245dc..5222b0858e3 100644 --- a/app/assets/javascripts/discourse/app/components/group-post.js +++ b/app/assets/javascripts/discourse/app/components/group-post.js @@ -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; + }, }); diff --git a/app/assets/javascripts/discourse/app/templates/components/group-post.hbs b/app/assets/javascripts/discourse/app/templates/components/group-post.hbs index 25c500b7823..69f0f605f44 100644 --- a/app/assets/javascripts/discourse/app/templates/components/group-post.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/group-post.hbs @@ -12,10 +12,10 @@
{{category-link post.category}}
- {{#if post.user.name}} -
- {{post.user.name}} - {{#if post.user.title}}, {{post.user.title}}{{/if}} + {{#if post.user}} +
+ {{name}} + {{#if post.user.title}}{{post.user.title}}{{/if}}
{{/if}}