FIX: adds back recurring to send_message automation (#18990)

Also uses new way to get channel title
This commit is contained in:
Joffrey JAFFEUX
2022-11-11 15:58:05 +01:00
committed by GitHub
parent f8939bd294
commit a578bc2f5f
2 changed files with 3 additions and 7 deletions

View File

@ -675,13 +675,13 @@ after_initialize do
placeholder :channel_name
triggerables [:recurring]
script do |context, fields, automation|
sender = User.find_by(username: fields.dig("sender", "value")) || Discourse.system_user
channel = ChatChannel.find_by(id: fields.dig("chat_channel_id", "value"))
placeholders = { channel_name: channel.public_channel_title }.merge(
context["placeholders"] || {},
)
placeholders = { channel_name: channel.title(sender) }.merge(context["placeholders"] || {})
creator =
Chat::ChatMessageCreator.create(