8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/services/newsmast_mastodon/overrides/notify_service_extension.rb', line 8
def call(recipient, type, activity)
return if recipient.user.nil?
@recipient = recipient
@activity = activity
@notification = Notification.new(account: @recipient, type: type, activity: @activity)
return if drop?
@notification.filtered = filter?
@notification.set_group_key!
@notification.save!
return if @notification.activity.nil?
if @notification.filtered?
update_notification_request!
NewsmastMastodon::CustomNotificationService.new.call(@recipient, @notification) if @notification.type == :mention
else
push_notification!
push_to_conversation! if direct_message?
send_email! if email_needed?
NewsmastMastodon::CustomNotificationService.new.call(@recipient, @notification)
end
rescue ActiveRecord::RecordInvalid
nil
end
|