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

Move udpate and destroy of shares into the WP scope

Klaus Zanders8f2599640a5d
diff --git a/app/controllers/work_packages/shares_controller.rb b/app/controllers/work_packages/shares_controller.rb
index c539a718568..930f2fc8dfc 100644
--- a/app/controllers/work_packages/shares_controller.rb
+++ b/app/controllers/work_packages/shares_controller.rb
@@ -30,7 +30,7 @@ class WorkPackages::SharesController < ApplicationController
include OpTurbo::ComponentStream
include MemberHelper
- before_action :find_work_package, only: %i[index create resend_invite]
+ before_action :find_work_package, only: %i[index create destroy update resend_invite]
before_action :find_share, only: %i[destroy update resend_invite]
before_action :find_project
before_action :authorize
@@ -200,8 +200,7 @@ class WorkPackages::SharesController < ApplicationController
end
def find_share
- @share = Member.of_any_work_package.find(params[:id])
- @work_package = @share.entity
+ @share = @work_package.members.find(params[:id])
end
def find_shares
diff --git a/config/routes.rb b/config/routes.rb
index 2c8206aceff..b5626b227e3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -517,8 +517,6 @@ Rails.application.routes.draw do
# FIXME: this is kind of evil!! We need to remove this soonest and
# cover the functionality. Route is being used in work-package-service.js:331
get "/bulk" => "bulk#destroy"
-
- resources :shares, only: %i[destroy update]
end
resources :work_packages, only: [:index] do
@@ -532,7 +530,7 @@ Rails.application.routes.draw do
get "details/*state" => "work_packages#index", on: :collection, as: :details
# Rails managed sharing route
- resources :shares, controller: "work_packages/shares", only: %i[index create] do
+ resources :shares, controller: "work_packages/shares", only: %i[index create update destroy] do
member do
post "resend_invite" => "work_packages/shares#resend_invite"
end