Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-09-21 12:19:32 +0300
committerDouwe Maan <douwe@gitlab.com>2015-09-21 12:19:32 +0300
commit183892fde98308c0d77f5ba7a9bdb23d79eebe43 (patch)
tree9cc63e2422b514e33337e9c3288c965a22bf7f97 /app/models
parent2460d290af892a24996b348c786757eb5398adc1 (diff)
parent47e926bec0a9da28daaca7dc92415b25f2301daf (diff)
Merge branch 'notification-levels' into 'master'
Notification levels can now be set on the Project's main page ![Screen_Shot_2015-09-16_at_7.49.49_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/0ac517bdfdc801f0e2115463c3ea9e10/Screen_Shot_2015-09-16_at_7.49.49_PM.png) The notification settings for a project can now be set directly on the Project's page. The drop down list and the button label reflect the current level. Saving is done via a remote form submission and if successful shows the user a flash message: ![Screen_Shot_2015-09-16_at_6.09.02_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/8a6e1fde5177aa3976cadf59fdb8d375/Screen_Shot_2015-09-16_at_6.09.02_PM.png) @DouweM can you please review my code. I gave my bestest effort to make in clean and readable. @rspeicher hopefully we can include it with the 8.0 release, maybe? /cc @darby See merge request !1322
Diffstat (limited to 'app/models')
-rw-r--r--app/models/notification.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 1395274173d..171b8df45c2 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -12,7 +12,7 @@ class Notification
class << self
def notification_levels
- [N_DISABLED, N_PARTICIPATING, N_WATCH, N_MENTION]
+ [N_DISABLED, N_MENTION, N_PARTICIPATING, N_WATCH]
end
def options_with_labels
@@ -26,7 +26,7 @@ class Notification
end
def project_notification_levels
- [N_DISABLED, N_PARTICIPATING, N_WATCH, N_GLOBAL, N_MENTION]
+ [N_DISABLED, N_MENTION, N_PARTICIPATING, N_WATCH, N_GLOBAL]
end
end
@@ -57,4 +57,21 @@ class Notification
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