Fix bug where links to posts weren't being tracked

This commit is contained in:
Robin Ward
2013-02-13 15:22:04 -05:00
parent 941820ac88
commit dee9e9a51f
4 changed files with 58 additions and 1 deletions

View File

@@ -53,6 +53,15 @@ class TopicLink < ActiveRecord::Base
topic_id = route[:topic_id]
post_number = route[:post_number] || 1
# Store the canonical URL
topic = Topic.where(id: topic_id).first
if topic.present?
url = "#{Discourse.base_url}#{topic.relative_url}"
url << "/#{post_number}" if post_number.to_i > 1
end
end
# Skip linking to ourselves