blob: a05c9c7a1e7b70324250eed890af68c539a41ac7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
class UpdateHighestRoleWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
feature_category :subscription_usage_reports
urgency :high
weight 2
idempotent!
def perform(user_id)
user = User.find_by_id(user_id)
return unless user.present?
if user.active? && user.human? && !user.internal?
Users::UpdateHighestMemberRoleService.new(user).execute
else
UserHighestRole.where(user_id: user_id).delete_all # rubocop: disable CodeReuse/ActiveRecord
end
end
end
|