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

parent ee497599
...@@ -105,7 +105,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -105,7 +105,7 @@ class ProjectsController < Projects::ApplicationController
@membership = @project.team.find_member(current_user.id) @membership = @project.team.find_member(current_user.id)
if @membership if @membership
@notification_setting = current_user.notification_settings.find_or_initialize_by(source: @project) @notification_setting = current_user.notification_settings_for(@project)
end end
end end
......
...@@ -831,6 +831,10 @@ class User < ActiveRecord::Base ...@@ -831,6 +831,10 @@ class User < ActiveRecord::Base
end end
end end
def notification_settings_for(source)
notification_settings.find_or_initialize_by(source: source)
end
private private
def projects_union def projects_union
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment