Class: OpenLoam::Notification
- Inherits:
-
TenantRecord
- Object
- TenantRecord
- OpenLoam::Notification
- Defined in:
- app/models/open_loam/notification.rb
Overview
One in-app message for one recipient (user) in one tenant. The same
person in two tenants has two separate inboxes — like everything else in
OpenLoam, "your notifications" always means "in the current tenant".
Plumbing, not business data: not audited, the same way OpenLoam::AuditRecord isn't. It IS evented, though — creating one publishes "open_loam.notification.created" (carrying the recipient's user_id) so OpenLoam::EventStream can push it to that user's browser and the bell updates live. Created through OpenLoam::Notifications.notify, read through the admin bell.
Instance Method Summary collapse
- #mark_read! ⇒ Object
-
#read? ⇒ Boolean
What the notification is about, if anything (source_type/source_id) — stored rather than associated, so a notification survives its subject.
Instance Method Details
#mark_read! ⇒ Object
31 32 33 34 |
# File 'app/models/open_loam/notification.rb', line 31 def mark_read! update!(read_at: Time.current) unless read? self end |
#read? ⇒ Boolean
What the notification is about, if anything (source_type/source_id) — stored rather than associated, so a notification survives its subject.
29 |
# File 'app/models/open_loam/notification.rb', line 29 def read? = read_at.present? |