Sha256: 41c0b89e972ade24d974422c3da54f8b12312941d069dd63237706c696a4f583
Contents?: true
Size: 490 Bytes
Versions: 15
Compression:
Stored size: 490 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_in_organization.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
15 entries across 15 versions & 1 rubygems