FEATURE: set notification levels when added to a group (#10378)

* FEATURE: set notification levels when added to a group

This feature allows admins and group owners to define default
category and tag tracking levels that will be applied to user
preferences automatically at the time when users are added to the
group. Users are free to change those preferences afterwards.
When removed from a group, the user's notification preferences aren't
changed.
This commit is contained in:
Neil Lalonde
2020-08-06 12:27:27 -04:00
committed by GitHub
parent cd4f251891
commit 1ca81fbb95
27 changed files with 937 additions and 8 deletions

View File

@ -604,6 +604,13 @@ class GroupsController < ApplicationController
default_params
end
if !automatic || current_user.admin
[:muted, :tracking, :watching, :watching_first_post].each do |level|
permitted_params << { "#{level}_category_ids" => [] }
permitted_params << { "#{level}_tags" => [] }
end
end
params.require(:group).permit(*permitted_params)
end