OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Check for the `add_work_package_notes` on the work package to allow commenting
Klaus Zanders16f0a449065e
diff --git a/lib/api/v3/activities/activities_by_work_package_api.rb b/lib/api/v3/activities/activities_by_work_package_api.rbindex 92840037737..5dd5f182e5e 100644--- a/lib/api/v3/activities/activities_by_work_package_api.rb+++ b/lib/api/v3/activities/activities_by_work_package_api.rb@@ -50,7 +50,7 @@ module APIrequires :comment, type: Hashendpost do- authorize_in_project({ controller: :journals, action: :new }, project: @work_package.project) do+ authorize_in_work_package({ controller: :journals, action: :new }, work_package: @work_package) doraise ::API::Errors::NotFound.newenddiff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rbindex 707649165a4..af00f6f2552 100644--- a/lib/api/v3/work_packages/work_package_representer.rb+++ b/lib/api/v3/work_packages/work_package_representer.rb@@ -277,7 +277,7 @@ module APIendlink :addComment,- cache_if: -> { current_user.allowed_in_project?(:add_work_package_notes, represented.project) } do+ cache_if: -> { current_user.allowed_in_work_package?(:add_work_package_notes, represented) } do{href: api_v3_paths.work_package_activities(represented.id),method: :post,diff --git a/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rb b/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rbindex 9254a68a124..df00d4379a6 100644--- a/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rb+++ b/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rb@@ -63,7 +63,7 @@ module OpenProject::GithubIntegrationWorkPackage.includes(:project).where(id: ids)- .select { |wp| user.allowed_in_project?(:add_work_package_notes, wp.project) }+ .select { |wp| user.allowed_in_work_package?(:add_work_package_notes, wp) }end# Returns a list of `WorkPackage`s that were referenced in the `text` and are visible to the given `user`.