Skip to content

Commit

Permalink
[#59785] No comments possible for shared work packages that were shar… (
Browse files Browse the repository at this point in the history
  • Loading branch information
jjabari-op authored Dec 3, 2024
1 parent 179fef3 commit 4e75a8c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def polling_interval
end

def adding_comment_allowed?
User.current.allowed_in_project?(:add_work_package_notes, @work_package.project)
User.current.allowed_in_work_package?(:add_work_package_notes, @work_package)
end
end
end
Expand Down
24 changes: 24 additions & 0 deletions spec/features/activities/work_package/activities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
member_with_roles: { project => user_role_with_editing_permission })
end

let(:comment_work_package_role) { create(:comment_work_package_role) }
let(:user_with_commenting_permission_via_a_work_package_share) do
create(:user,
firstname: "A",
lastname: "Commenter",
member_with_roles: { work_package => comment_work_package_role })
end

let(:work_package) { create(:work_package, project:, author: admin) }
let(:first_comment) do
create(:work_package_journal, user: admin, notes: "First comment by admin", journable: work_package,
Expand Down Expand Up @@ -205,6 +213,22 @@
end
end
end

context "when a user has been shared a work package with at least comment rights" do
current_user { user_with_commenting_permission_via_a_work_package_share }

before do
wp_page.visit!
wp_page.wait_for_activity_tab
end

it "allows commenting on the work package" do
activity_tab.expect_input_field

activity_tab.add_comment(text: "First comment by user with commenting permission via a work package share")
activity_tab.expect_journal_notes(text: "First comment by user with commenting permission via a work package share")
end
end
end

context "when a workpackage is created and visited by the same user" do
Expand Down

0 comments on commit 4e75a8c

Please sign in to comment.