mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user