Add method to return the user notification setting for a group, or a project

This commit is contained in:
Douglas Barbosa Alexandre 2016-04-08 17:35:21 -03:00
parent ee497599cc
commit 635b65d120
2 changed files with 5 additions and 1 deletions

View File

@ -105,7 +105,7 @@ class ProjectsController < Projects::ApplicationController
@membership = @project.team.find_member(current_user.id)
if @membership
@notification_setting = current_user.notification_settings.find_or_initialize_by(source: @project)
@notification_setting = current_user.notification_settings_for(@project)
end
end

View File

@ -831,6 +831,10 @@ class User < ActiveRecord::Base
end
end
def notification_settings_for(source)
notification_settings.find_or_initialize_by(source: source)
end
private
def projects_union