diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-06-18 09:23:31 +0200 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-06-18 09:23:31 +0200 |
commit | 56777e89562fe9c81f6e9237bff9cee6420fc093 (patch) | |
tree | a18d1dfad849311b38812db98d3f9cad520a49dc /app/models/notification.rb | |
parent | 9169c7e81fb906cf9f419d195d73a585b19dafbc (diff) | |
parent | 00906b5bb6cde8cb60281109060a519a54000c61 (diff) | |
download | gitlab-ce-56777e89562fe9c81f6e9237bff9cee6420fc093.tar.gz |
Merge branch 'master' into ci-scala-example
Diffstat (limited to 'app/models/notification.rb')
-rw-r--r-- | app/models/notification.rb | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb deleted file mode 100644 index 171b8df45c2..00000000000 --- a/app/models/notification.rb +++ /dev/null @@ -1,77 +0,0 @@ -class Notification - # - # Notification levels - # - N_DISABLED = 0 - N_PARTICIPATING = 1 - N_WATCH = 2 - N_GLOBAL = 3 - N_MENTION = 4 - - attr_accessor :target - - class << self - def notification_levels - [N_DISABLED, N_MENTION, N_PARTICIPATING, N_WATCH] - end - - def options_with_labels - { - disabled: N_DISABLED, - participating: N_PARTICIPATING, - watch: N_WATCH, - mention: N_MENTION, - global: N_GLOBAL - } - end - - def project_notification_levels - [N_DISABLED, N_MENTION, N_PARTICIPATING, N_WATCH, N_GLOBAL] - end - end - - def initialize(target) - @target = target - end - - def disabled? - target.notification_level == N_DISABLED - end - - def participating? - target.notification_level == N_PARTICIPATING - end - - def watch? - target.notification_level == N_WATCH - end - - def global? - target.notification_level == N_GLOBAL - end - - def mention? - target.notification_level == N_MENTION - end - - def level - target.notification_level - end - - def to_s - case level - when N_DISABLED - 'Disabled' - when N_PARTICIPATING - 'Participating' - when N_WATCH - 'Watching' - when N_MENTION - 'On mention' - when N_GLOBAL - 'Global' - else - # do nothing - end - end -end |