mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: moves channel-archive-status to channels subscriptions (#19567)
It was quite an oddball because its a global subscription created on each channel. channels manager now allows us to elegantly solve this case.
This commit is contained in:
@@ -111,7 +111,6 @@ class ChatChannelSerializer < ApplicationSerializer
|
||||
new_mentions:
|
||||
@opts[:new_mentions_message_bus_last_id] ||
|
||||
MessageBus.last_id(ChatPublisher.new_mentions_message_bus_channel(object.id)),
|
||||
archive_status: MessageBus.last_id("/chat/channel-archive-status"),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -45,6 +45,8 @@ class StructuredChannelSerializer < ApplicationSerializer
|
||||
channel_edits: chat_message_bus_last_ids[ChatPublisher::CHANNEL_EDITS_MESSAGE_BUS_CHANNEL],
|
||||
channel_status: chat_message_bus_last_ids[ChatPublisher::CHANNEL_STATUS_MESSAGE_BUS_CHANNEL],
|
||||
new_channel: chat_message_bus_last_ids[ChatPublisher::NEW_CHANNEL_MESSAGE_BUS_CHANNEL],
|
||||
archive_status:
|
||||
chat_message_bus_last_ids[ChatPublisher::CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL],
|
||||
}
|
||||
|
||||
if id =
|
||||
@@ -67,6 +69,7 @@ class StructuredChannelSerializer < ApplicationSerializer
|
||||
ChatPublisher::CHANNEL_EDITS_MESSAGE_BUS_CHANNEL,
|
||||
ChatPublisher::CHANNEL_STATUS_MESSAGE_BUS_CHANNEL,
|
||||
ChatPublisher::NEW_CHANNEL_MESSAGE_BUS_CHANNEL,
|
||||
ChatPublisher::CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL,
|
||||
]
|
||||
|
||||
if !scope.anonymous?
|
||||
|
||||
@@ -230,6 +230,8 @@ module ChatPublisher
|
||||
)
|
||||
end
|
||||
|
||||
CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL = "/chat/channel-archive-status"
|
||||
|
||||
def self.publish_archive_status(
|
||||
chat_channel,
|
||||
archive_status:,
|
||||
@@ -238,7 +240,7 @@ module ChatPublisher
|
||||
total_messages:
|
||||
)
|
||||
MessageBus.publish(
|
||||
"/chat/channel-archive-status",
|
||||
CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL,
|
||||
{
|
||||
chat_channel_id: chat_channel.id,
|
||||
archive_failed: archive_status == :failed,
|
||||
|
||||
Reference in New Issue
Block a user