Sha256: 758c4cb3df6574ac6a2e5d2615ea04a326f005a40f21d66e89db59c35386daf5

Contents?: true

Size: 597 Bytes

Versions: 99

Compression:

Stored size: 597 Bytes

Contents

module Mumuki::Laboratory::Controllers::Notifications

  def user_notifications_path
    user_path(anchor: current_notifications_tab)
  end

  def has_notifications?
    notifications_count > 0
  end

  def notifications_count
    messages_count + discussions_count
  end

  private

  def current_notifications_tab
    has_messages? ? 'messages' : 'discussions'
  end

  def has_messages?
    messages_count > 0
  end

  def messages_count
    current_user.try(:unread_messages).try(:count) || 0
  end

  def discussions_count
    current_user.try(:unread_discussions).try(:count) || 0
  end
end

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
mumuki-laboratory-8.5.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.4.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.3.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.2.1 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.2.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.1.3 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.1.2 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.1.1 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.1.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.12.3 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-8.0.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.12.1 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.12.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.11.1 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.11.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.10.5 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.10.4 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.10.3 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.10.2 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-7.10.1 lib/mumuki/laboratory/controllers/notifications.rb