2021-07-28 19:14:07 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-23 21:19:08 +08:00
|
|
|
class Notification < ApplicationRecord
|
2023-10-11 19:43:20 +08:00
|
|
|
include Noticed::Model
|
2023-12-12 21:08:42 +08:00
|
|
|
|
2023-10-11 19:43:20 +08:00
|
|
|
belongs_to :recipient, polymorphic: true
|
2021-07-28 19:14:07 +08:00
|
|
|
|
2023-12-12 22:24:53 +08:00
|
|
|
scope :in_app, lambda {
|
|
|
|
where.not("notifications.params ? 'hide_in_app' AND notifications.params->'hide_in_app' = 'true'")
|
|
|
|
}
|
2023-12-12 21:08:42 +08:00
|
|
|
|
2021-07-28 19:14:07 +08:00
|
|
|
private
|
2021-02-25 14:43:04 +08:00
|
|
|
|
2021-07-28 19:14:07 +08:00
|
|
|
def can_send_to_user?(_user)
|
|
|
|
true # overridable send permission method
|
2021-02-25 14:43:04 +08:00
|
|
|
end
|
2016-09-28 20:18:52 +08:00
|
|
|
end
|