diff options
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r-- | app/controllers/profiles/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/profiles/notifications_controller.rb | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/controllers/profiles/groups_controller.rb b/app/controllers/profiles/groups_controller.rb index c755bcb718a..04b5ee270dc 100644 --- a/app/controllers/profiles/groups_controller.rb +++ b/app/controllers/profiles/groups_controller.rb @@ -5,7 +5,7 @@ class Profiles::GroupsController < Profiles::ApplicationController def update group = find_routable!(Group, params[:id]) - notification_setting = current_user.notification_settings.find_by(source: group) # rubocop: disable CodeReuse/ActiveRecord + notification_setting = current_user.notification_settings_for(group) if notification_setting.update(update_params) flash[:notice] = "Notification settings for #{group.name} saved" diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 617e5bb7cb3..5f44e55f3ef 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -3,9 +3,14 @@ class Profiles::NotificationsController < Profiles::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def show - @user = current_user - @group_notifications = current_user.notification_settings.for_groups.order(:id) - @project_notifications = current_user.notification_settings.for_projects.order(:id) + @user = current_user + @group_notifications = current_user.notification_settings.for_groups.order(:id) + @group_notifications += GroupsFinder.new( + current_user, + all_available: false, + exclude_group_ids: @group_notifications.select(:source_id) + ).execute.map { |group| current_user.notification_settings_for(group, inherit: true) } + @project_notifications = current_user.notification_settings.for_projects.order(:id) @global_notification_setting = current_user.global_notification_setting end # rubocop: enable CodeReuse/ActiveRecord |