Add method to return the user notification setting for a group, or a project
This commit is contained in:
parent
ee497599cc
commit
635b65d120
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue