From 3c9bd6f511662cfcb45dea3f77dfa3e83bcc64e0 Mon Sep 17 00:00:00 2001 From: zmagod Date: Wed, 2 Nov 2016 14:44:16 +0100 Subject: [PATCH] enables notification to be extended --- app/models/notification.rb | 2 +- config/initializers/constants.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/notification.rb b/app/models/notification.rb index 98b7e9c4e..d65f8ebc1 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -3,7 +3,7 @@ class Notification < ActiveRecord::Base has_many :users, through: :user_notifications belongs_to :generator_user, class_name: 'User' - enum type_of: [:assignment, :recent_changes, :system_message] + enum type_of: Constants::NOTIFICATIONS_TYPES def already_seen(user) UserNotification.where(notification: self, user: user) diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index becd940ec..60ffb3fd6 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -196,6 +196,10 @@ class Constants 'text/plain' ].freeze + # Notification types. Should not be freezed, as modules might append to this. + NOTIFICATIONS_TYPES = { assignment: 0, + recent_changes: 1, + system_message: 2 } # Organization name for default admin user DEFAULT_PRIVATE_ORG_NAME = 'My projects'.freeze