From e1ab7bda4ba2cc544d570f34d53678f24c2980be Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Fri, 7 Jul 2023 07:06:43 +0400 Subject: [PATCH] Project card permission with not assigned team admin [SCI-8727] --- app/services/toolbars/projects_service.rb | 2 + .../index/_project_actions_dropdown.html.erb | 196 ++++++++++-------- 2 files changed, 107 insertions(+), 91 deletions(-) diff --git a/app/services/toolbars/projects_service.rb b/app/services/toolbars/projects_service.rb index 98594b3c1..a653a1f34 100644 --- a/app/services/toolbars/projects_service.rb +++ b/app/services/toolbars/projects_service.rb @@ -13,6 +13,7 @@ module Toolbars @project_folders = current_user.current_team.project_folders.where(id: project_folder_ids) @items = @projects + @project_folders + @not_assigned = @projects.any? { |project| !project.assigned_users.include?(current_user) } @single = @items.length == 1 @@ -29,6 +30,7 @@ module Toolbars def actions return [] if @item_type == :none + return [access_action] if @not_assigned [ restore_action, diff --git a/app/views/projects/index/_project_actions_dropdown.html.erb b/app/views/projects/index/_project_actions_dropdown.html.erb index 2c88b534c..fea1ba0d6 100644 --- a/app/views/projects/index/_project_actions_dropdown.html.erb +++ b/app/views/projects/index/_project_actions_dropdown.html.erb @@ -3,98 +3,112 @@ <% project_form = f %> <%= f.hidden_field :archived, value: !project.archived %> <% end %> + +<% assigned = project.assigned_users.include?(current_user) %>