feat(ntfy): add NtfyDispatchable concern for fanning out to admins

This commit is contained in:
Min Zeya Phyo
2026-07-28 02:13:51 +08:00
parent 88e9ff5ff7
commit e75c5b3bdc
2 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
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