mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
DEV: Add option to send system message to groups (#12256)
This commit is contained in:
@ -18,15 +18,16 @@ class SystemMessage
|
||||
end
|
||||
|
||||
def create(type, params = {})
|
||||
from_system = params.delete(:from_system)
|
||||
target_group_names = params.delete(:target_group_names)
|
||||
|
||||
params = defaults.merge(params)
|
||||
from_system = params[:from_system] || false
|
||||
|
||||
title = params[:message_title] || I18n.with_locale(@recipient.effective_locale) { I18n.t("system_messages.#{type}.subject_template", params) }
|
||||
raw = params[:message_raw] || I18n.with_locale(@recipient.effective_locale) { I18n.t("system_messages.#{type}.text_body_template", params) }
|
||||
|
||||
if from_system
|
||||
user = Discourse.system_user
|
||||
target_group_names = nil
|
||||
else
|
||||
user = Discourse.site_contact_user
|
||||
target_group_names = Group.exists?(name: SiteSetting.site_contact_group_name) ? SiteSetting.site_contact_group_name : nil
|
||||
|
Reference in New Issue
Block a user