mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: support silent internal links (#25472)
Internal links always notify and add internal connections in topics. This adds a special feature that lets you append `?silent=true` to a link to have it excluded from: 1. Notifications - users will not be notified for these links 2. Post links below posts in the UI This is specifically useful for large reports where adding all these connections just results in noise.
This commit is contained in:
@ -69,6 +69,18 @@ RSpec.describe TopicLink do
|
||||
end
|
||||
|
||||
describe "internal links" do
|
||||
it "can exclude links with ?silent=true" do
|
||||
url = topic.url
|
||||
raw = "[silent link](#{url}?silent=true)"
|
||||
|
||||
post = Fabricate(:post, user: user, raw: raw)
|
||||
|
||||
TopicLink.extract_from(post)
|
||||
|
||||
expect(topic.topic_links.count).to eq(0)
|
||||
expect(post.topic.topic_links.count).to eq(0)
|
||||
end
|
||||
|
||||
it "extracts onebox" do
|
||||
other_topic = Fabricate(:topic, user: user)
|
||||
Fabricate(:post, topic: other_topic, user: user, raw: "some content for the first post")
|
||||
|
Reference in New Issue
Block a user