Skip to content

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

More fixes for OP v13.1.0

Benjamin Teyd97c0f82ed3a
diff --git a/README.md b/README.md
index f204837fff2..a39be3e20d4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Introducing OpenProject GitLab Integration v2.1.3 GA
+## Introducing OpenProject GitLab Integration v2.1.4 GA
Based on the OpenProject Github Integration, this plugin offers the same functionalities plus other new features. This is the first version that includes the visualization of the status of the *Pipelines* (by now, it is considered in Beta status). You can test it by activating the Pipelines event in the GitLab webhook. Just keep in mind that not all pipelines will be reflected in OpenProject, only Merge Request type pipelines (for more information see the GitLab issue https://gitlab.com/gitlab-org/gitlab/-/issues/345028). Any feedback about the pipelines feature would be very appreciated, whether it works or if issues arise (you can use this ticket https://github.com/btey/openproject-gitlab-integration/issues/43).
@@ -159,7 +159,7 @@ Add the following in **Gemfile.lock**:
PATH
remote: modules/gitlab_integration
specs:
- openproject-gitlab_integration (2.1.2)
+ openproject-gitlab_integration (2.1.4)
openproject-webhooks
```
diff --git a/lib/api/v3/gitlab_issues/gitlab_issues_by_work_package_api.rb b/lib/api/v3/gitlab_issues/gitlab_issues_by_work_package_api.rb
index b715058e424..ab59f2b1c94 100644
--- a/lib/api/v3/gitlab_issues/gitlab_issues_by_work_package_api.rb
+++ b/lib/api/v3/gitlab_issues/gitlab_issues_by_work_package_api.rb
@@ -34,7 +34,7 @@ module API
module GitlabIssues
class GitlabIssuesByWorkPackageAPI < ::API::OpenProjectAPI
after_validation do
- authorize(:show_gitlab_content, context: @work_package.project)
+ authorize_in_work_package(:show_gitlab_content, work_package: @work_package)
@gitlab_issues = @work_package.gitlab_issues
end
diff --git a/lib/api/v3/gitlab_merge_requests/gitlab_merge_requests_by_work_package_api.rb b/lib/api/v3/gitlab_merge_requests/gitlab_merge_requests_by_work_package_api.rb
index 3976818491b..a2de4eacdbe 100644
--- a/lib/api/v3/gitlab_merge_requests/gitlab_merge_requests_by_work_package_api.rb
+++ b/lib/api/v3/gitlab_merge_requests/gitlab_merge_requests_by_work_package_api.rb
@@ -34,7 +34,7 @@ module API
module GitlabMergeRequests
class GitlabMergeRequestsByWorkPackageAPI < ::API::OpenProjectAPI
after_validation do
- authorize(:show_gitlab_content, context: @work_package.project)
+ authorize_in_work_package(:show_gitlab_content, work_package: @work_package)
@gitlab_merge_requests = @work_package.gitlab_merge_requests
end
diff --git a/lib/open_project/gitlab_integration/notification_handler/helper.rb b/lib/open_project/gitlab_integration/notification_handler/helper.rb
index 396ff1e3567..7f9a0eed503 100644
--- a/lib/open_project/gitlab_integration/notification_handler/helper.rb
+++ b/lib/open_project/gitlab_integration/notification_handler/helper.rb
@@ -75,7 +75,7 @@ module OpenProject::GitlabIntegration
WorkPackage
.includes(:project)
.where(id: ids)
- .select { |wp| user.allowed_to?(: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`.
diff --git a/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb b/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb
index 0c2a8cf1c09..e16f17e6a1f 100644
--- a/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb
+++ b/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb
@@ -35,7 +35,7 @@ module OpenProject::GitlabIntegration
def extension
->(*) do
link :gitlab,
- cache_if: -> { current_user.allowed_to?(:show_gitlab_content, represented.project) } do
+ cache_if: -> { current_user.allowed_in_work_package?(:show_gitlab_content, represented) } do
next if represented.new_record?
{
diff --git a/openproject-gitlab_integration.gemspec b/openproject-gitlab_integration.gemspec
index 9510dabadca..d5fe6edce69 100644
--- a/openproject-gitlab_integration.gemspec
+++ b/openproject-gitlab_integration.gemspec
@@ -32,7 +32,7 @@
Gem::Specification.new do |s|
s.name = 'openproject-gitlab_integration'
- s.version = '2.1.3'
+ s.version = '2.1.4'
s.authors = 'Ben Tey'
s.email = '[email protected]'
s.homepage = 'https://github.com/btey/openproject-gitlab-integration'