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

View File

@ -12,9 +12,6 @@ describe "Assign | Assigning posts", type: :system do
before do before do
SiteSetting.assign_enabled = true 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) sign_in(admin)
end end
@ -43,7 +40,7 @@ describe "Assign | Assigning posts", type: :system do
expect(page).to have_no_css("#topic .assigned-to") expect(page).to have_no_css("#topic .assigned-to")
end end
it "can submit form with shortcut from texatea" do it "can submit modal form with shortcuts" do
visit "/t/#{topic.id}" visit "/t/#{topic.id}"
topic_page.click_assign_post(post2) 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(post1.post_number)).to have_content(staff_user.name)
expect(topic_page.find_post_assign(post2.post_number)).to have_content(staff_user.name) expect(topic_page.find_post_assign(post2.post_number)).to have_content(staff_user.name)
end 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 end
context "when assigns are not public" do context "when assigns are not public" do

View File

@ -61,6 +61,18 @@ describe "Assign | Assigning topics", type: :system do
assign_modal.confirm assign_modal.confirm
expect(find("#topic .assigned-to")).to have_content(staff_user.name) expect(find("#topic .assigned-to")).to have_content(staff_user.name)
end 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 end
context "when assigns are not public" do context "when assigns are not public" do