mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 22:09:12 +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:
@ -12,6 +12,8 @@ describe Chat::ChatChannelArchiveService do
|
||||
let(:topic_params) { { topic_title: "This will be a new topic", category_id: category.id } }
|
||||
subject { Chat::ChatChannelArchiveService }
|
||||
|
||||
before { SiteSetting.chat_enabled = true }
|
||||
|
||||
describe "#create_archive_process" do
|
||||
before { 3.times { Fabricate(:chat_message, chat_channel: channel) } }
|
||||
|
||||
@ -184,6 +186,20 @@ describe Chat::ChatChannelArchiveService do
|
||||
expect(pm_topic.first_post.raw).to include("Title can't have more than 1 emoji")
|
||||
end
|
||||
|
||||
context "when enable_experimental_hashtag_autocomplete" do
|
||||
before { SiteSetting.enable_experimental_hashtag_autocomplete = true }
|
||||
|
||||
it "uses the channel slug to autolink a hashtag for the channel in the PM" do
|
||||
create_messages(3) && start_archive
|
||||
subject.new(@channel_archive).execute
|
||||
expect(@channel_archive.reload.complete?).to eq(true)
|
||||
pm_topic = Topic.private_messages.last
|
||||
expect(pm_topic.first_post.cooked).to include(
|
||||
"<a class=\"hashtag-cooked\" href=\"#{channel.relative_url}\" data-type=\"channel\" data-slug=\"#{channel.slug}\" data-ref=\"#{channel.slug}::channel\"><svg class=\"fa d-icon d-icon-comment svg-icon svg-node\"><use href=\"#comment\"></use></svg><span>#{channel.title(user)}</span></a>",
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "channel members" do
|
||||
before do
|
||||
create_messages(3)
|
||||
|
Reference in New Issue
Block a user