further user name display changes
This commit is contained in:
parent
5ad68a55d4
commit
4be24d6c31
|
@ -72,7 +72,12 @@ export default {
|
||||||
const content = [];
|
const content = [];
|
||||||
|
|
||||||
if (this.topic.isAssigned()) {
|
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()) {
|
if (this.topic.hasAssignedPosts()) {
|
||||||
|
@ -131,9 +136,14 @@ function reassignToSelfButton() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function unassignFromTopicButton(topic) {
|
function unassignFromTopicButton(topic, prioritize_full_name_in_ux) {
|
||||||
const username =
|
let username =
|
||||||
topic.assigned_to_user?.username || topic.assigned_to_group?.name;
|
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
|
const icon = topic.assigned_to_user
|
||||||
? avatarHtml(topic.assigned_to_user, "small")
|
? avatarHtml(topic.assigned_to_user, "small")
|
||||||
: iconHTML("user-xmark");
|
: iconHTML("user-xmark");
|
||||||
|
|
|
@ -405,9 +405,7 @@ class ::Assigner
|
||||||
if SiteSetting.unassign_creates_tracking_post && !silent
|
if SiteSetting.unassign_creates_tracking_post && !silent
|
||||||
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
|
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
|
||||||
|
|
||||||
custom_fields = {
|
custom_fields = small_action_username_or_name(assigned_to)
|
||||||
"action_code_who" => assigned_to.is_a?(User) ? assigned_to.username : assigned_to.name,
|
|
||||||
}
|
|
||||||
|
|
||||||
if post_target?
|
if post_target?
|
||||||
custom_fields.merge!("action_code_path" => "/p/#{@target.id}")
|
custom_fields.merge!("action_code_path" => "/p/#{@target.id}")
|
||||||
|
@ -493,10 +491,19 @@ class ::Assigner
|
||||||
Jobs.enqueue(:assign_notification, assignment_id: assignment.id)
|
Jobs.enqueue(:assign_notification, assignment_id: assignment.id)
|
||||||
end
|
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)
|
def add_small_action_post(action_code, assign_to, text)
|
||||||
custom_fields = {
|
custom_fields = small_action_username_or_name(assign_to)
|
||||||
"action_code_who" => assign_to.is_a?(User) ? assign_to.username : assign_to.name,
|
|
||||||
}
|
|
||||||
|
|
||||||
if post_target?
|
if post_target?
|
||||||
custom_fields.merge!(
|
custom_fields.merge!(
|
||||||
|
|
Loading…
Reference in New Issue