added suggested changes

This commit is contained in:
Juan David Martinez 2025-03-07 14:57:00 -05:00
parent 880ed7a92f
commit 174f88ecae
No known key found for this signature in database
GPG Key ID: FE50F4B983E68D5B
3 changed files with 41 additions and 20 deletions

View File

@ -480,11 +480,11 @@ function initialize(api) {
}
const icon = iconHTML(assignee.username ? "user-plus" : "group-plus");
let name;
if (siteSettings.prioritize_full_name_in_ux || !assignee.username) {
name = assignee.name;
} else {
name = assignee.username;
}
name =
this.siteSettings.prioritize_full_name_in_ux || !assignee.username
? assignee.name || assignee.username
: assignee.username;
const tagName = params.tagName || "a";
const href =
@ -578,13 +578,13 @@ function initialize(api) {
})
)}</span>`;
};
let displayedName = "";
if (assignedToUser) {
if (this.siteSettings.prioritize_full_name_in_ux) {
displayedName = assignedToUser.name;
} else {
displayedName = assignedToUser.username;
}
this.siteSettings.prioritize_full_name_in_ux
? assignedToUser.name || assignedToUser.username
: assignedToUser.username;
assigneeElements.push(
h(
"span.assignee",
@ -617,12 +617,11 @@ function initialize(api) {
Object.keys(indirectlyAssignedTo).map((postId) => {
const assignee = indirectlyAssignedTo[postId].assigned_to;
const postNumber = indirectlyAssignedTo[postId].post_number;
if (this.siteSettings.prioritize_full_name_in_ux || !assignee.username) {
displayedName = assignee.name;
} else{
displayedName = assignee.username;
}
displayedName =
this.siteSettings.prioritize_full_name_in_ux || !assignee.username
? assignee.name || assignee.username
: assignee.username;
assigneeElements.push(
h("span.assignee", [
h(

View File

@ -12,9 +12,6 @@ describe "Assign | Assigning posts", type: :system do
before do
SiteSetting.assign_enabled = true
# # The system tests in this file are flaky and auth token related so turning this on
# SiteSetting.verbose_auth_token_logging = true
sign_in(admin)
end
@ -43,7 +40,7 @@ describe "Assign | Assigning posts", type: :system do
expect(page).to have_no_css("#topic .assigned-to")
end
it "can submit form with shortcut from texatea" do
it "can submit modal form with shortcuts" do
visit "/t/#{topic.id}"
topic_page.click_assign_post(post2)
@ -70,6 +67,19 @@ describe "Assign | Assigning posts", type: :system do
expect(topic_page.find_post_assign(post1.post_number)).to have_content(staff_user.name)
expect(topic_page.find_post_assign(post2.post_number)).to have_content(staff_user.name)
end
it "show the user's username if there is no name" do
visit "/t/#{topic.id}"
staff_user.name = nil
staff_user.save
staff_user.reload
topic_page.click_assign_post(post2)
assign_modal.assignee = staff_user
assign_modal.confirm
expect(topic_page.find_post_assign(post1.post_number)).to have_content(staff_user.username)
expect(topic_page.find_post_assign(post2.post_number)).to have_content(staff_user.username)
end
end
context "when assigns are not public" do

View File

@ -61,6 +61,18 @@ describe "Assign | Assigning topics", type: :system do
assign_modal.confirm
expect(find("#topic .assigned-to")).to have_content(staff_user.name)
end
it "show the user's username if there is no name" do
visit "/t/#{topic.id}"
staff_user.name = nil
staff_user.save
staff_user.reload
topic_page.click_assign_topic
assign_modal.assignee = staff_user
assign_modal.confirm
expect(find("#topic .assigned-to")).to have_content(staff_user.name)
end
end
context "when assigns are not public" do