mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 19:53:19 +08:00
Merge pull request #2876 from aignatov-bio/ai-sci-5066-fix-switch-team
Fix switch team on link for object from other team [SCI-5066]
This commit is contained in:
commit
9010f9c1db
3 changed files with 3 additions and 2 deletions
|
@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base
|
|||
private
|
||||
|
||||
def update_current_team
|
||||
current_team = Team.find_by_id(current_user.current_team_id)
|
||||
@current_team = Team.find_by_id(current_user.current_team_id)
|
||||
if (current_team.nil? || !current_user.is_member_of_team?(current_team)) &&
|
||||
current_user.teams.count.positive?
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ class ProjectsController < ApplicationController
|
|||
include TeamsHelper
|
||||
include InputSanitizeHelper
|
||||
|
||||
before_action :switch_team_with_param, only: :index
|
||||
before_action :load_vars, only: %i(show edit update
|
||||
notifications reports
|
||||
samples experiment_archive
|
||||
|
@ -37,7 +38,6 @@ class ProjectsController < ApplicationController
|
|||
}
|
||||
end
|
||||
format.html do
|
||||
current_team_switch(Team.find_by_id(params[:team])) if params[:team]
|
||||
@teams = current_user.teams
|
||||
# New project for create new project modal
|
||||
@project = Project.new
|
||||
|
|
|
@ -4,6 +4,7 @@ module TeamsHelper
|
|||
if team != current_team
|
||||
current_user.current_team_id = team.id
|
||||
current_user.save
|
||||
update_current_team
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue