mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 18:03:38 +08:00
FIX: subfolder: top referred topics report was missing subfolder in links
This commit is contained in:
parent
5b356e446a
commit
ce79ec0127
|
@ -224,7 +224,7 @@
|
|||
<td class="title">
|
||||
<div class="referred-topic-title">
|
||||
<div class="overflow-ellipsis">
|
||||
<a href="/t/{{unbound data.topic_slug}}/{{unbound data.topic_id}}">{{data.topic_title}}</a>
|
||||
<a href="{{unbound data.topic_url}}">{{data.topic_title}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -102,7 +102,7 @@ class IncomingLinksReport
|
|||
num_clicks.each do |topic_id, num_clicks_element|
|
||||
topic = topics.find { |t| t.id == topic_id }
|
||||
if topic
|
||||
report.data << { topic_id: topic_id, topic_title: topic.title, topic_slug: topic.slug, num_clicks: num_clicks_element }
|
||||
report.data << { topic_id: topic_id, topic_title: topic.title, topic_url: topic.relative_url, num_clicks: num_clicks_element }
|
||||
end
|
||||
end
|
||||
report.data
|
||||
|
|
|
@ -52,8 +52,8 @@ describe IncomingLinksReport do
|
|||
|
||||
r = IncomingLinksReport.find('top_referred_topics').as_json
|
||||
expect(r[:data]).to eq [
|
||||
{ topic_id: p1.topic.id, topic_title: p1.topic.title, topic_slug: p1.topic.slug, num_clicks: 7 },
|
||||
{ topic_id: p2.topic.id, topic_title: p2.topic.title, topic_slug: p2.topic.slug, num_clicks: 2 + 3 },
|
||||
{ topic_id: p1.topic.id, topic_title: p1.topic.title, topic_url: p1.topic.relative_url, num_clicks: 7 },
|
||||
{ topic_id: p2.topic.id, topic_title: p2.topic.title, topic_url: p2.topic.relative_url, num_clicks: 2 + 3 },
|
||||
]
|
||||
end
|
||||
end
|
||||
|
@ -163,8 +163,8 @@ describe IncomingLinksReport do
|
|||
IncomingLinksReport.stubs(:link_count_per_topic).returns(topic1.id => 8, topic2.id => 3)
|
||||
Topic.stubs(:select).returns(Topic); Topic.stubs(:where).returns(Topic) # bypass some activerecord methods
|
||||
Topic.stubs(:all).returns([topic1, topic2])
|
||||
expect(top_referred_topics[:data][0]).to eq(topic_id: topic1.id, topic_title: topic1.title, topic_slug: topic1.slug, num_clicks: 8)
|
||||
expect(top_referred_topics[:data][1]).to eq(topic_id: topic2.id, topic_title: topic2.title, topic_slug: topic2.slug, num_clicks: 3)
|
||||
expect(top_referred_topics[:data][0]).to eq(topic_id: topic1.id, topic_title: topic1.title, topic_url: topic1.relative_url, num_clicks: 8)
|
||||
expect(top_referred_topics[:data][1]).to eq(topic_id: topic2.id, topic_title: topic2.title, topic_url: topic2.relative_url, num_clicks: 3)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user