FIX: Use hashtags in channel archive PMs if available (#19859)

If the enable_experimental_hashtag_autocomplete setting is
enabled, then we should autolink hashtag references to the
archived channels (e.g. #blah::channel) for a nicer UX, and
just show the channel name if not (since doing #channelName
can lead to weird inconsistent results).
This commit is contained in:
Martin Brennan
2023-01-16 10:20:37 +10:00
committed by GitHub
parent d59ed1cbfe
commit 2eb0a300b6
3 changed files with 27 additions and 4 deletions

View File

@ -248,7 +248,7 @@ class Chat::ChatChannelArchiveService
def notify_archiver(result, error_message: nil)
base_translation_params = {
channel_name: chat_channel_title,
channel_hashtag_or_name: channel_hashtag_or_name,
topic_title: chat_channel_archive.destination_topic&.title,
topic_url: chat_channel_archive.destination_topic&.url,
topic_validation_errors: result == :failed_no_topic ? error_message : nil,
@ -301,4 +301,11 @@ class Chat::ChatChannelArchiveService
def kick_all_users
Chat::ChatChannelMembershipManager.new(chat_channel).unfollow_all_users
end
def channel_hashtag_or_name
if chat_channel.slug.present? && SiteSetting.enable_experimental_hashtag_autocomplete
return "##{chat_channel.slug}::channel"
end
chat_channel_title
end
end