2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class GroupDestroyWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2017-08-24 15:24:58 -04:00
|
|
|
include ExceptionBacktrace
|
2016-05-28 22:54:17 -04:00
|
|
|
|
2020-01-09 07:08:03 -05:00
|
|
|
feature_category :subgroups
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2016-05-28 22:54:17 -04:00
|
|
|
def perform(group_id, user_id)
|
|
|
|
begin
|
2018-01-02 11:21:28 -05:00
|
|
|
group = Group.find(group_id)
|
2016-05-28 22:54:17 -04:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
user = User.find(user_id)
|
|
|
|
|
2016-08-13 08:45:31 -04:00
|
|
|
Groups::DestroyService.new(group, user).execute
|
2016-05-28 22:54:17 -04:00
|
|
|
end
|
|
|
|
end
|