From 13c33c3c05e010905cb7f19bbad6fbf9834eab7e Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 5 Aug 2022 14:13:36 +0200 Subject: [PATCH] Fix team switching when viewing repository from another team [SCI-7058] --- app/controllers/repositories_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 7128631e6..0f02a41b4 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -9,7 +9,6 @@ class RepositoriesController < ApplicationController include RepositoriesDatatableHelper include MyModulesHelper - before_action :switch_team_with_param, only: :show before_action :load_repository, except: %i(index create create_modal sidebar archive restore) before_action :load_repositories, only: %i(index show sidebar) before_action :load_repositories_for_archiving, only: :archive @@ -47,6 +46,7 @@ class RepositoriesController < ApplicationController end def show + current_team_switch(@repository.team) @display_edit_button = can_create_repository_rows?(@repository) @display_delete_button = can_delete_repository_rows?(@repository) @display_duplicate_button = can_create_repository_rows?(@repository) @@ -425,7 +425,7 @@ class RepositoriesController < ApplicationController def load_repository repository_id = params[:id] || params[:repository_id] - @repository = Repository.accessible_by_teams(current_team).find_by(id: repository_id) + @repository = Repository.accessible_by_teams(current_user.teams).find_by(id: repository_id) render_404 unless @repository end