diff --git a/app/controllers/repository_rows_controller.rb b/app/controllers/repository_rows_controller.rb index 335291900..8654bcabe 100644 --- a/app/controllers/repository_rows_controller.rb +++ b/app/controllers/repository_rows_controller.rb @@ -6,7 +6,8 @@ class RepositoryRowsController < ApplicationController MAX_PRINTABLE_ITEM_NAME_LENGTH = 64 - before_action :load_repository, except: :show + before_action :load_repository, except: %i(show print_modal print) + before_action :load_repository_or_snapshot, only: %i(print_modal print) 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) @@ -261,6 +262,13 @@ class RepositoryRowsController < ApplicationController render_404 unless @repository end + def load_repository_or_snapshot + @repository = Repository.accessible_by_teams(current_team).find_by(id: params[:repository_id]) + @repository ||= RepositorySnapshot.find_by(id: params[:repository_id]) + + render_404 unless @repository + end + def load_repository_row @repository_row = @repository.repository_rows.eager_load(:repository_columns).find_by(id: params[:id]) render_404 unless @repository_row