2017-09-10 07:58:38 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class BootstrapTimelineService < BaseService
|
|
|
|
def call(source_account)
|
2018-06-15 16:00:23 +00:00
|
|
|
@source_account = source_account
|
|
|
|
|
|
|
|
autofollow_inviter!
|
2022-02-23 15:45:22 +00:00
|
|
|
notify_staff!
|
2017-09-10 07:58:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-06-15 16:00:23 +00:00
|
|
|
def autofollow_inviter!
|
|
|
|
return unless @source_account&.user&.invite&.autofollow?
|
2017-09-10 07:58:38 +00:00
|
|
|
|
2021-04-24 15:01:43 +00:00
|
|
|
FollowService.new.call(@source_account, @source_account.user.invite.user.account)
|
2017-09-10 07:58:38 +00:00
|
|
|
end
|
2022-02-23 15:45:22 +00:00
|
|
|
|
|
|
|
def notify_staff!
|
2022-07-05 00:41:40 +00:00
|
|
|
User.those_who_can(:manage_users).includes(:account).find_each do |user|
|
2022-03-04 00:06:33 +00:00
|
|
|
LocalNotificationWorker.perform_async(user.account_id, @source_account.id, 'Account', 'admin.sign_up')
|
2022-02-23 15:45:22 +00:00
|
|
|
end
|
|
|
|
end
|
2017-09-10 07:58:38 +00:00
|
|
|
end
|