2018-11-08 19:23:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
class GroupDestroyWorker # rubocop:disable Scalability/IdempotentWorker
|
2018-03-17 18:26:18 +05:30
|
|
|
include ApplicationWorker
|
|
|
|
include ExceptionBacktrace
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
feature_category :subgroups
|
2021-01-03 14:25:43 +05:30
|
|
|
tags :requires_disk_io
|
2019-12-21 20:55:43 +05:30
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
def perform(group_id, user_id)
|
|
|
|
begin
|
2018-03-17 18:26:18 +05:30
|
|
|
group = Group.find(group_id)
|
2016-09-13 17:45:13 +05:30
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
user = User.find(user_id)
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
Groups::DestroyService.new(group, user).execute
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|