22 lines
524 B
Ruby
22 lines
524 B
Ruby
module NtfyDispatchable
|
|
extend ActiveSupport::Concern
|
|
|
|
class_methods do
|
|
def dispatch_ntfy(event_type, title:, message:, priority: 3, tags: [], click: nil)
|
|
AdminUser.where(ntfy_enabled: true).find_each do |admin|
|
|
next unless admin.ntfy_configured?
|
|
|
|
SendNtfyNotificationJob.perform_later(
|
|
admin.id,
|
|
event_type,
|
|
title: title,
|
|
message: message,
|
|
priority: priority,
|
|
tags: tags,
|
|
click: click
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|