From a578bc2f5faccef27ef1d4c7f0b41cd2f51df57e Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 11 Nov 2022 15:58:05 +0100 Subject: [PATCH] FIX: adds back recurring to send_message automation (#18990) Also uses new way to get channel title --- plugins/chat/app/models/chat_channel.rb | 4 ---- plugins/chat/plugin.rb | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/chat/app/models/chat_channel.rb b/plugins/chat/app/models/chat_channel.rb index 560ae2d322..c2cbca6fd3 100644 --- a/plugins/chat/app/models/chat_channel.rb +++ b/plugins/chat/app/models/chat_channel.rb @@ -83,10 +83,6 @@ class ChatChannel < ActiveRecord::Base "/chat/channel/#{self.id}/#{self.slug || "-"}" end - def public_channel_title - chatable.name - end - private def change_status(acting_user, target_status) diff --git a/plugins/chat/plugin.rb b/plugins/chat/plugin.rb index 1c76b23274..933266ad5e 100644 --- a/plugins/chat/plugin.rb +++ b/plugins/chat/plugin.rb @@ -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(