Merge pull request #2772 from mlorb/ml-sci-4907

Fix inventory card view for snapshots as default view [SCI-4907]
This commit is contained in:
mlorb 2020-08-11 14:43:19 +02:00 committed by GitHub
commit 02bb29cf79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,9 +4,9 @@ class RepositoryRowsController < ApplicationController
include ApplicationHelper
include MyModulesHelper
before_action :load_repository
before_action :load_repository_row, only: %i(update show assigned_task_list)
before_action :check_read_permissions, except: %i(create update delete_records copy_records)
before_action :load_repository, except: :show
before_action :load_repository_row, only: %i(update assigned_task_list)
before_action :check_read_permissions, except: %i(show create update delete_records copy_records)
before_action :check_snapshotting_status, only: %i(create update delete_records copy_records)
before_action :check_create_permissions, only: :create
before_action :check_delete_permissions, only: %i(delete_records archive_records restore_records)
@ -51,6 +51,11 @@ class RepositoryRowsController < ApplicationController
end
def show
@repository_row = RepositoryRow.find_by(id: params[:id])
return render_404 unless @repository_row
return render_404 unless @repository_row.repository_id == params[:repository_id].to_i
return render_403 unless can_read_repository?(@repository_row.repository)
@assigned_modules = @repository_row.my_modules.joins(experiment: :project)
@viewable_modules = @assigned_modules.viewable_by_user(current_user, current_user.teams)
@private_modules = @assigned_modules - @viewable_modules