mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:58:33 +08:00
FEATURE: Add skip notification option to group invite to topic (#29741)
* FEATURE: Add skip notification option to group invite to topic * DEV: rename `skip_notification` to `should_notify` * DEV: update `should_notify` param to be default `true` in controllers * DEV: update spec to use `greater than` instead of `equal to` to prevent flakiness * Update app/controllers/topics_controller.rb Co-authored-by: David Taylor <david@taylorhq.com> * DEV: merged two `#invite_group` specs into one * DEV: Added test case for `invite-group` in requests spec --------- Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
@ -757,7 +757,13 @@ class TopicsController < ApplicationController
|
||||
|
||||
if topic.private_message?
|
||||
guardian.ensure_can_invite_group_to_private_message!(group, topic)
|
||||
topic.invite_group(current_user, group)
|
||||
should_notify =
|
||||
if params[:should_notify].blank?
|
||||
true
|
||||
else
|
||||
params[:should_notify].to_s == "true"
|
||||
end
|
||||
topic.invite_group(current_user, group, should_notify: should_notify)
|
||||
render_json_dump BasicGroupSerializer.new(group, scope: guardian, root: "group")
|
||||
else
|
||||
render json: failed_json, status: 422
|
||||
|
Reference in New Issue
Block a user