2023-10-11 19:43:20 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-17 18:02:55 +08:00
|
|
|
class DeliveryNotification < BaseNotification
|
2023-12-08 20:57:43 +08:00
|
|
|
def self.subtype
|
|
|
|
:delivery
|
|
|
|
end
|
2023-10-11 19:43:20 +08:00
|
|
|
|
|
|
|
def message
|
|
|
|
params[:message]
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
params[:title]
|
|
|
|
end
|
2023-12-12 19:11:52 +08:00
|
|
|
|
|
|
|
def subject
|
|
|
|
return unless params[:subject_id] && params[:subject_class]
|
|
|
|
|
2024-08-01 17:38:12 +08:00
|
|
|
subject_class.find(params[:subject_id])
|
2023-12-12 19:11:52 +08:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
NonExistantRecord.new(params[:subject_name])
|
|
|
|
end
|
2023-10-11 19:43:20 +08:00
|
|
|
end
|