summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-05-06 16:40:27 -0300
committerFelipe Artur <felipefac@gmail.com>2016-05-17 21:53:04 -0500
commitc2c7014e017a36e2819335653f5d3fc04cc2c054 (patch)
treed245e4a242a03be141ef85c08039f0df00a04d47 /app
parent07ff874f572a947d7730787492a604dd3f44d496 (diff)
downloadgitlab-ce-c2c7014e017a36e2819335653f5d3fc04cc2c054.tar.gz
Improve documentation and add changelog
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb6
-rw-r--r--app/models/user.rb7
2 files changed, 4 insertions, 9 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 55632308b4f..6d2b6b60f13 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -101,11 +101,7 @@ class ProjectsController < Projects::ApplicationController
respond_to do |format|
format.html do
- if current_user
- if can?(current_user, :read_project, @project)
- @notification_setting = current_user.notification_settings_for(@project)
- end
- end
+ @notification_setting = current_user.notification_settings_for(@project) if current_user
if @project.repository_exists?
if @project.empty_repo?
diff --git a/app/models/user.rb b/app/models/user.rb
index cc312a291c6..09fb6c978f3 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -777,11 +777,10 @@ class User < ActiveRecord::Base
end
def notification_settings_for(source)
- notification_setting = notification_settings.find_or_initialize_by({ source: source })
+ notification_setting = notification_settings.find_or_initialize_by(source: source)
- if source.is_a?(Project)
- membership = source.team.find_member(self.id)
- notification_setting.level = :disabled unless membership.present? || notification_setting.persisted?
+ if source.is_a?(Project) && !source.team.member?(id) && !notification_setting.persisted?
+ notification_setting.level = :disabled
end
notification_setting