Fix typo in update team assignments service, improve shared inventories migration [SCI-7360]

This commit is contained in:
Oleksii Kriuchykhin 2022-10-21 14:04:33 +02:00
parent 2ddb6d8685
commit a9e7e81e51
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)