diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-04-12 16:39:40 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-04-12 16:39:40 +0000 |
commit | 4516f40dfe7167417280391d2cd7f12772c3eda5 (patch) | |
tree | c3859ffb92673088aeee3b208efa6e7607330b60 /lib | |
parent | 2082879d2f3f91b038863f7c67c658d678924564 (diff) | |
parent | 61a62e00e3b08e6ed962b029564e3a2446e169fd (diff) | |
download | gitlab-ce-4516f40dfe7167417280391d2cd7f12772c3eda5.tar.gz |
Merge branch 'decouple-member-notification' into 'master'
Decouple membership and notifications
This allow you to have notification setting per project even if you are member of group.
It also creates background for having notification settings in project you are not member of.
- [x] Make it work
- [x] Migrations
- [x] CHANGELOG
- [x] More tests
- [x] API
For #3359
After this merge request there is still some work to be done:
* create migration that remove duplicates in notification settings table and create uniq index (8.8 probably)
* remove notification_level field from Member model in 9.0
* make proper API for notification settings
* use `MemberCreateService` instead of Member#after_create callback for creating notification settings (after #14709)
* maybe more tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
See merge request !3421
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 939469b3886..60b9f5e0ece 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -263,14 +263,19 @@ module API expose :id, :path, :kind end - class ProjectAccess < Grape::Entity + class Member < Grape::Entity expose :access_level - expose :notification_level + expose :notification_level do |member, options| + if member.notification_setting + NotificationSetting.levels[member.notification_setting.level] + end + end end - class GroupAccess < Grape::Entity - expose :access_level - expose :notification_level + class ProjectAccess < Member + end + + class GroupAccess < Member end class ProjectService < Grape::Entity |