Fix the failing test: repository row should be in correct repository

This commit is contained in:
Miha Mencin 2020-08-06 13:23:40 +02:00 committed by GitHub
parent 3a8fc01ff7
commit 04c294adb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,10 +53,9 @@ class RepositoryRowsController < ApplicationController
def show
@repository_row = RepositoryRow.find_by(id: params[:id])
render_403 unless can_read_repository?(@repository_row.repository)
row = RepositoryRow.find_by(id: @repository_row.parent_id) if @repository_row.parent_id
row ||= @repository_row
@assigned_modules = row.my_modules.joins(experiment: :project)
render_403 unless @repository_row.repository_id == params[:repository_id]
@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