mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow using 'top' view for topic list embed (#12825)
This commit is contained in:
committed by
GitHub
parent
a872df87f6
commit
a74783d157
@@ -100,6 +100,22 @@ describe EmbedController do
|
||||
expect(response.body).to match("data-referer=\"https://example.com/evil-trout\"")
|
||||
end
|
||||
|
||||
it "returns a list of topics" do
|
||||
bad_topic = Fabricate(:topic)
|
||||
good_topic = Fabricate(:topic, like_count: 1000, posts_count: 100)
|
||||
TopTopic.refresh!
|
||||
|
||||
get '/embed/topics?discourse_embed_id=de-1234&top_period=yearly', headers: {
|
||||
'REFERER' => 'https://example.com/evil-trout'
|
||||
}
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.headers['X-Frame-Options']).to be_nil
|
||||
expect(response.body).to match("data-embed-id=\"de-1234\"")
|
||||
expect(response.body).to match("data-topic-id=\"#{good_topic.id}\"")
|
||||
expect(response.body).not_to match("data-topic-id=\"#{bad_topic.id}\"")
|
||||
expect(response.body).to match("data-referer=\"https://example.com/evil-trout\"")
|
||||
end
|
||||
|
||||
it "returns no referer if not supplied" do
|
||||
get '/embed/topics?discourse_embed_id=de-1234'
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
Reference in New Issue
Block a user