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

Version Path
mumuki-domain-9.11.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.10.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.9.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.8.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.7.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.6.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.5.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.4.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.3.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.2.1 app/models/concerns/with_notifications.rb
mumuki-domain-9.2.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.1.2 app/models/concerns/with_notifications.rb
mumuki-domain-9.1.1 app/models/concerns/with_notifications.rb
mumuki-domain-9.1.0 app/models/concerns/with_notifications.rb
mumuki-domain-9.0.6 app/models/concerns/with_notifications.rb
mumuki-domain-9.0.5 app/models/concerns/with_notifications.rb
mumuki-domain-9.0.4 app/models/concerns/with_notifications.rb
mumuki-domain-9.0.3 app/models/concerns/with_notifications.rb
mumuki-domain-9.0.2 app/models/concerns/with_notifications.rb
mumuki-domain-9.0.0 app/models/concerns/with_notifications.rb