mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
DEV: start/stop reply implementation (#29542)
* DEV: join/leave presence chat-reply when streaming This commit ensures that starting/stopping a chat message with the streaming option will automatically make the creator of the message as present in the chat-reply channel. * implements start/stop reply * not needed
This commit is contained in:
@ -316,8 +316,16 @@ after_initialize do
|
||||
end
|
||||
|
||||
register_presence_channel_prefix("chat-reply") do |channel_name|
|
||||
if chat_channel_id = channel_name[%r{/chat-reply/(\d+)}, 1]
|
||||
chat_channel = Chat::Channel.find(chat_channel_id)
|
||||
if (
|
||||
channel_id, thread_id =
|
||||
channel_name.match(%r{^/chat-reply/(\d+)(?:/thread/(\d+))?$})&.captures
|
||||
)
|
||||
chat_channel = nil
|
||||
if thread_id
|
||||
chat_channel = Chat::Thread.find_by!(id: thread_id, channel_id: channel_id).channel
|
||||
else
|
||||
chat_channel = Chat::Channel.find(channel_id)
|
||||
end
|
||||
|
||||
PresenceChannel::Config.new.tap do |config|
|
||||
config.allowed_group_ids = chat_channel.allowed_group_ids
|
||||
|
Reference in New Issue
Block a user