This repository was archived by the owner on Jul 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
FIX: Ensure assign plugin respects prioritize_full_name_in_ux site setting
#632
Merged
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9bd1a19
WIP
brrusselburg 8f11f6c
more messing around
brrusselburg 230256f
undos, notes to self
brrusselburg 730c9bd
WIP notes
brrusselburg 64fe74c
completed logic and added tests for existing code and implemented code
jdmartinez1062 ee8dc35
fixed failing tests
jdmartinez1062 880ed7a
fixed failing tests
jdmartinez1062 174f88e
added suggested changes
jdmartinez1062 770d06f
added suggested changes
jdmartinez1062 a7cc705
fix merge
jdmartinez1062 d35e508
fix linting issues
jdmartinez1062 48d20f1
possible flaky test
jdmartinez1062 5ad68a5
removed comment
jdmartinez1062 4be24d6
further user name display changes
jdmartinez1062 8aea4cf
implemented suggested change
jdmartinez1062 4bacf2c
fixed bug in small action post when assigning or unassigning
jdmartinez1062 6f7a7ab
fixed breaking tests
jdmartinez1062 7279e8e
refactored test
jdmartinez1062 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,198 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| describe "Assign | Assigning posts", type: :system do | ||
| let(:topic_page) { PageObjects::Pages::Topic.new } | ||
| let(:assign_modal) { PageObjects::Modals::Assign.new } | ||
| fab!(:staff_user) { Fabricate(:user, groups: [Group[:staff]]) } | ||
| fab!(:admin) | ||
| fab!(:topic) | ||
| fab!(:post1) { Fabricate(:post, topic: topic) } | ||
| fab!(:post2) { Fabricate(:post, topic: topic) } | ||
|
|
||
| before do | ||
| SiteSetting.assign_enabled = true | ||
| SiteSetting.prioritize_full_name_in_ux = false | ||
|
|
||
| # 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 | ||
|
|
||
| describe "with open topic" do | ||
| before { SiteSetting.prioritize_full_name_in_ux = false } | ||
|
|
||
| it "can assign and unassign" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
| assign_modal.confirm | ||
|
|
||
| expect(assign_modal).to be_closed | ||
|
|
||
| expect(topic_page).to have_assigned_post(user: staff_user, at_post: 3) | ||
|
|
||
| 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) | ||
|
|
||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_unassign_post(post2) | ||
|
|
||
| expect(topic_page).to have_unassigned_from_post(user: staff_user, at_post: 4) | ||
| expect(page).to have_no_css("#topic .assigned-to") | ||
| end | ||
|
|
||
| it "can submit modal form with shortcuts" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
|
|
||
| find("body").send_keys(:tab) | ||
| find("body").send_keys(:control, :enter) | ||
|
|
||
| expect(assign_modal).to be_closed | ||
| expect(topic_page).to have_assigned_post(user: staff_user, at_post: 3) | ||
| 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 | ||
|
|
||
| context "when prioritize_full_name_in_ux setting is enabled" do | ||
| before { SiteSetting.prioritize_full_name_in_ux = true } | ||
brrusselburg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| it "shows the user's name after assign" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| 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.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 | ||
| before { SiteSetting.assigns_public = false } | ||
|
|
||
| it "assigned small action post has 'private-assign' in class attribute" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
| assign_modal.confirm | ||
|
|
||
| expect(assign_modal).to be_closed | ||
| expect(topic_page).to have_assigned_post( | ||
| user: staff_user, | ||
| at_post: 3, | ||
| class_attribute: ".private-assign", | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context "when unassign_on_close is set to true" do | ||
| before { SiteSetting.unassign_on_close = true } | ||
|
|
||
| it "unassigns the topic on close" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
| assign_modal.confirm | ||
|
|
||
| expect(assign_modal).to be_closed | ||
| expect(topic_page).to have_assigned_post(user: staff_user, at_post: 3) | ||
|
|
||
| find(".timeline-controls .toggle-admin-menu").click | ||
| find(".topic-admin-close").click | ||
|
|
||
| expect(find("#post_4")).to have_content( | ||
| I18n.t("js.action_codes.closed.enabled", when: "just now"), | ||
| ) | ||
| expect(page).to have_no_css("#post_5") | ||
| expect(page).to have_no_css("#topic .assigned-to") | ||
| end | ||
|
|
||
| it "can assign the previous assignee" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
| assign_modal.confirm | ||
|
|
||
| expect(assign_modal).to be_closed | ||
| expect(topic_page).to have_assigned_post(user: staff_user, at_post: 3) | ||
|
|
||
| find(".timeline-controls .toggle-admin-menu").click | ||
| find(".topic-admin-close").click | ||
|
|
||
| expect(find("#post_4")).to have_content( | ||
| I18n.t("js.action_codes.closed.enabled", when: "just now"), | ||
|
||
| ) | ||
| expect(page).to have_no_css("#post_5") | ||
| expect(page).to have_no_css("#topic .assigned-to") | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
| assign_modal.confirm | ||
|
|
||
| expect(page).to have_no_css("#post_5") | ||
| 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 | ||
|
|
||
| context "when reassign_on_open is set to true" do | ||
| before { SiteSetting.reassign_on_open = true } | ||
|
|
||
| it "reassigns the topic on open" do | ||
| visit "/t/#{topic.id}" | ||
|
|
||
| topic_page.click_assign_post(post2) | ||
| assign_modal.assignee = staff_user | ||
| assign_modal.confirm | ||
|
|
||
| expect(assign_modal).to be_closed | ||
| expect(topic_page).to have_assigned_post(user: staff_user, at_post: 3) | ||
|
|
||
| find(".timeline-controls .toggle-admin-menu").click | ||
| find(".topic-admin-close").click | ||
|
|
||
| expect(find("#post_4")).to have_content( | ||
| I18n.t("js.action_codes.closed.enabled", when: "just now"), | ||
| ) | ||
| expect(page).to have_no_css("#post_5") | ||
| expect(page).to have_no_css("#topic .assigned-to") | ||
|
|
||
| find(".timeline-controls .toggle-admin-menu").click | ||
| find(".topic-admin-open").click | ||
|
|
||
| expect(find("#post_5")).to have_content( | ||
| I18n.t("js.action_codes.closed.disabled", when: "just now"), | ||
| ) | ||
| expect(page).to have_no_css("#post_6") | ||
| 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 | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.