summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorFrancisco Lopez <fjlopez@gitlab.com>2017-11-30 12:52:38 +0100
committerFrancisco Lopez <fjlopez@gitlab.com>2017-12-01 18:32:12 +0100
commit194f7bca9a286942bcd764c836180964e33a1e92 (patch)
treedd1612a1188dcc0fc9436d2c19de8227b661cc07 /app/models/user.rb
parent58c5b463ff75618a557d067c16f49ef581cda85c (diff)
downloadgitlab-ce-194f7bca9a286942bcd764c836180964e33a1e92.tar.gz
Comments from code review applied. Also switched forked_from_project and ForkedProjectLinks to ForkNetworkMember
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 14941fd7f98..ee12f541b0f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -998,7 +998,11 @@ class User < ActiveRecord::Base
end
def notification_settings_for(source)
- notification_settings.find_or_initialize_by(source: source)
+ if notification_settings.loaded?
+ notification_settings.find { |notification| notification.source == source }
+ else
+ notification_settings.find_or_initialize_by(source: source)
+ end
end
# Lazy load global notification setting