A platform for community discussion. Free, open, simple.
FIX: Make chat tracking payload backwards compatible (#20852)
Martin Brennanc912c58d6c5f
diff --git a/plugins/chat/app/services/chat/publisher.rb b/plugins/chat/app/services/chat/publisher.rbindex eb246691c88..fc6a3f12a81 100644--- a/plugins/chat/app/services/chat/publisher.rb+++ b/plugins/chat/app/services/chat/publisher.rb@@ -129,7 +129,14 @@ module Chatenddef self.publish_user_tracking_state(user, chat_channel_id, chat_message_id)- data = { channel_id: chat_channel_id, last_read_message_id: chat_message_id }.merge(+ data = {+ channel_id: chat_channel_id,+ last_read_message_id: chat_message_id,+ # TODO (martin) Remove old chat_channel_id and chat_message_id keys here once deploys have cycled,+ # this will prevent JS errors from clients that are looking for the old payload.+ chat_channel_id: chat_channel_id,+ chat_message_id: chat_message_id,+ }.merge(Chat::ChannelUnreadsQuery.call(channel_ids: [chat_channel_id], user_id: user.id).first.to_h,)