2023-10-11 19:43:20 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-17 18:02:55 +08:00
|
|
|
class GeneralNotification < BaseNotification
|
2023-10-11 19:43:20 +08:00
|
|
|
def message
|
|
|
|
params[:message]
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
params[:title]
|
|
|
|
end
|
2023-11-24 21:58:46 +08:00
|
|
|
|
|
|
|
def subtype
|
|
|
|
params[:type]
|
|
|
|
end
|
2023-11-27 18:29:27 +08:00
|
|
|
|
|
|
|
def subject
|
2023-12-11 22:41:24 +08:00
|
|
|
subject_class = params[:subject_class].constantize
|
|
|
|
subject_class.find(params[:subject_id])
|
|
|
|
rescue NameError, ActiveRecord::RecordNotFound
|
|
|
|
NonExistantRecord.new(params[:subject_name])
|
2023-11-27 18:29:27 +08:00
|
|
|
end
|
2023-10-11 19:43:20 +08:00
|
|
|
end
|