Sha256: 044d0d056b99a9a9ecb05b88b0797a877397e4a6d1c02255fba8ea8ca1cfbc1f
Contents?: true
Size: 474 Bytes
Versions: 20
Compression:
Stored size: 474 Bytes
Contents
module WithNotifications extend ActiveSupport::Concern def unread_messages messages_in_organization.where read: false end def unread_notifications # TODO: message and discussion should trigger a notification instead of being one all = notifications.where(read: false) + unread_messages + unread_discussions all.sort_by(&:created_at).reverse end def read_notification!(target) notifications.find_by(target: target)&.mark_as_read! end end
Version data entries
20 entries across 20 versions & 1 rubygems