further user name display changes

This commit is contained in:
Juan David Martinez 2025-03-10 23:43:28 -05:00
parent 5ad68a55d4
commit 4be24d6c31
No known key found for this signature in database
GPG Key ID: FE50F4B983E68D5B
2 changed files with 26 additions and 9 deletions

View File

@ -72,7 +72,12 @@ export default {
const content = [];
if (this.topic.isAssigned()) {
content.push(unassignFromTopicButton(this.topic));
content.push(
unassignFromTopicButton(
this.topic,
this.siteSettings.prioritize_full_name_in_ux
)
);
}
if (this.topic.hasAssignedPosts()) {
@ -131,9 +136,14 @@ function reassignToSelfButton() {
};
}
function unassignFromTopicButton(topic) {
const username =
function unassignFromTopicButton(topic, prioritize_full_name_in_ux) {
let username =
topic.assigned_to_user?.username || topic.assigned_to_group?.name;
if (topic.assigned_to_user && prioritize_full_name_in_ux) {
username = topic.assigned_to_user?.name || topic.assigned_to_user?.username;
}
const icon = topic.assigned_to_user
? avatarHtml(topic.assigned_to_user, "small")
: iconHTML("user-xmark");

View File

@ -405,9 +405,7 @@ class ::Assigner
if SiteSetting.unassign_creates_tracking_post && !silent
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
custom_fields = {
"action_code_who" => assigned_to.is_a?(User) ? assigned_to.username : assigned_to.name,
}
custom_fields = small_action_username_or_name(assigned_to)
if post_target?
custom_fields.merge!("action_code_path" => "/p/#{@target.id}")
@ -493,10 +491,19 @@ class ::Assigner
Jobs.enqueue(:assign_notification, assignment_id: assignment.id)
end
def small_action_username_or_name(assign_to)
if assign_to.is_a?(User) && SiteSetting.prioritize_full_name_in_ux && !assign_to.username
custom_fields = { "action_code_who" => assign_to.name || assign_to.username }
else
custom_fields = {
"action_code_who" => assign_to.is_a?(User) ? assign_to.username : assign_to.name,
}
end
custom_fields
end
def add_small_action_post(action_code, assign_to, text)
custom_fields = {
"action_code_who" => assign_to.is_a?(User) ? assign_to.username : assign_to.name,
}
custom_fields = small_action_username_or_name(assign_to)
if post_target?
custom_fields.merge!(