FEATURE: Link chat notifications directly to message (#23617)

- Updates `Chat::Message#url` to work in threads and for subfolder
- Updates Jobs::Chat::NotifyWatching to use message URL instead of channel url
This commit is contained in:
David Taylor
2023-09-16 20:37:35 +01:00
committed by GitHub
parent ebe68e15fc
commit 2791e75072
4 changed files with 24 additions and 6 deletions

View File

@ -589,4 +589,18 @@ describe Chat::Message do
expect(message.chat_mentions.pluck(:id)).to include(*existing_mention_ids) # the mentions weren't recreated
end
end
describe "#url" do
it "returns message permalink" do
expect(message.url).to eq("/chat/c/-/#{message.chat_channel_id}/#{message.id}")
end
it "returns message permalink when in thread" do
thread = Fabricate(:chat_thread)
first_message = thread.chat_messages.first
expect(first_message.url).to eq(
"/chat/c/-/#{first_message.chat_channel_id}/t/#{first_message.thread_id}/#{first_message.id}",
)
end
end
end