mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add hooks to allow overriding notify_user behavior (#23850)
Adds new plugin registry `:post_action_notify_user_handlers` and more!
This commit is contained in:
committed by
GitHub
parent
38e7960082
commit
f29c476521
@@ -58,7 +58,19 @@ module PostGuardian
|
||||
|
||||
if action_key == :notify_user &&
|
||||
!@user.in_any_groups?(SiteSetting.personal_message_enabled_groups_map)
|
||||
return false
|
||||
# The modifier below is used to add additional permissions for notifying users.
|
||||
# In core the only method of notifying a user is personal messages so we check if the
|
||||
# user can PM. Plugins can extend the behavior of how users are notifier via `notify_user`
|
||||
# post action, and this allows extension for that use case.
|
||||
can_notify = false
|
||||
can_notify =
|
||||
DiscoursePluginRegistry.apply_modifier(
|
||||
:post_guardian_can_notify_user,
|
||||
can_notify,
|
||||
self,
|
||||
post,
|
||||
)
|
||||
return can_notify
|
||||
end
|
||||
|
||||
# we allow flagging for trust level 1 and higher
|
||||
|
||||
Reference in New Issue
Block a user