From c2c7014e017a36e2819335653f5d3fc04cc2c054 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Fri, 6 May 2016 16:40:27 -0300 Subject: Improve documentation and add changelog --- app/controllers/projects_controller.rb | 6 +----- app/models/user.rb | 7 +++---- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'app') 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 -- cgit v1.2.1