mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 10:11:25 +08:00
FIX: adds post_quote as placeholder (#29083)
The script `send_chat_message` when used with the `post_created_edited` trigger now accepts `{{post_quote}}` as placeholder for the value of `message`. This is made possible by a new method in `utils`. Usage: ```ruby placeholders["foo"] = utils.build_quote(post) ```
This commit is contained in:
@ -463,6 +463,7 @@ after_initialize do
|
||||
field :sender, component: :user
|
||||
|
||||
placeholder :channel_name
|
||||
placeholder :post_quote, triggerable: :post_created_edited
|
||||
|
||||
triggerables %i[recurring topic_tags_changed post_created_edited]
|
||||
|
||||
@ -471,6 +472,10 @@ after_initialize do
|
||||
channel = Chat::Channel.find_by(id: fields.dig("chat_channel_id", "value"))
|
||||
placeholders = { channel_name: channel.title(sender) }.merge(context["placeholders"] || {})
|
||||
|
||||
if context["kind"] == "post_created_edited"
|
||||
placeholders[:post_quote] = utils.build_quote(context["post"])
|
||||
end
|
||||
|
||||
creator =
|
||||
::Chat::CreateMessage.call(
|
||||
chat_channel_id: channel.id,
|
||||
|
Reference in New Issue
Block a user