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