Class: NotificationReason

Inherits:
Object
  • Object
show all
Defined in:
app/models/notification_reason.rb

Overview

Holds reasons for a notification to have been sent as well as a priority list to select which reason to use above the rest

Constant Summary collapse

OWN_ACTIVITY =
'own_activity'
ASSIGNED =
'assigned'
REVIEW_REQUESTED =
'review_requested'
MENTIONED =
'mentioned'
SUBSCRIBED =
'subscribed'
REASON_PRIORITY =

Priority list for selecting which reason to return in the notification

[
  OWN_ACTIVITY,
  ASSIGNED,
  REVIEW_REQUESTED,
  MENTIONED,
  SUBSCRIBED
].freeze

Class Method Summary collapse

Class Method Details

.priority(reason) ⇒ Object

returns the priority of a reason as an integer



22
23
24
# File 'app/models/notification_reason.rb', line 22

def self.priority(reason)
  REASON_PRIORITY.index(reason) || REASON_PRIORITY.length + 1
end