Merge pull request #4563 from okriuchykhin/ok_SCI_7360_v2

Fix typo in update team assignments service, improve shared inventories migration [SCI-7360]
This commit is contained in:
Alex Kriuchykhin 2022-10-21 14:36:52 +02:00 committed by GitHub
commit 3bc3036b58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View file

@ -4,9 +4,9 @@ module UserAssignments
class RemoveTeamUserAssignmentsJob < ApplicationJob
queue_as :high_priority
def perform(user, team)
def perform(team_user_assignment)
ActiveRecord::Base.transaction do
RemoveTeamUserAssignmentsService.new(user, team).call
RemoveTeamUserAssignmentsService.new(team_user_assignment).call
end
end
end

View file

@ -4,9 +4,9 @@ module UserAssignments
class UpdateTeamUserAssignmentsJob < ApplicationJob
queue_as :high_priority
def perform(user, team, user_role)
def perform(team_user_assignment)
ActiveRecord::Base.transaction do
UpdateTeamUserAssignmentsService.new(user, team, user_role).call
UpdateTeamUserAssignmentsService.new(team_user_assignment).call
end
end
end

View file

@ -5,7 +5,7 @@ module UserAssignments
def initialize(team_user_assignment)
@user = team_user_assignment.user
@team = team_user_assignment.assignable
@user_role = user_role
@user_role = team_user_assignment.user_role
end
def call

View file

@ -12,6 +12,8 @@ class MigrateSharedRepositoriesToUserAssignments < ActiveRecord::Migration[6.1]
TeamRepository.where(permission_level: %i(shared_read shared_write))
.preload(:team, :repository)
.find_each do |team_repository|
next if team_repository.repository.blank?
team_repository.team
.user_assignments
.preload(:user, :user_role)