mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-07 12:49:38 -05:00
Fix specs.
This commit is contained in:
parent
95efdce74f
commit
191d2283f4
1 changed files with 17 additions and 10 deletions
|
@ -133,7 +133,7 @@ class TopicLink < ActiveRecord::Base
|
||||||
# We aren't interested in tracking internal links to users
|
# We aren't interested in tracking internal links to users
|
||||||
next if route[:controller] == 'users'
|
next if route[:controller] == 'users'
|
||||||
|
|
||||||
topic_id = route[:topic_id]
|
topic_id = route[:topic_id].to_i
|
||||||
post_number = route[:post_number] || 1
|
post_number = route[:post_number] || 1
|
||||||
|
|
||||||
# Store the canonical URL
|
# Store the canonical URL
|
||||||
|
@ -159,6 +159,12 @@ class TopicLink < ActiveRecord::Base
|
||||||
next if parsed && parsed.host && parsed.host.length > TopicLink.max_domain_length
|
next if parsed && parsed.host && parsed.host.length > TopicLink.max_domain_length
|
||||||
|
|
||||||
added_urls << url
|
added_urls << url
|
||||||
|
|
||||||
|
topic_link = TopicLink.find_by(topic_id: post.topic_id,
|
||||||
|
user_id: post.user_id,
|
||||||
|
url: url)
|
||||||
|
|
||||||
|
unless topic_link
|
||||||
TopicLink.create!(post_id: post.id,
|
TopicLink.create!(post_id: post.id,
|
||||||
user_id: post.user_id,
|
user_id: post.user_id,
|
||||||
topic_id: post.topic_id,
|
topic_id: post.topic_id,
|
||||||
|
@ -168,6 +174,7 @@ class TopicLink < ActiveRecord::Base
|
||||||
link_topic_id: topic_id,
|
link_topic_id: topic_id,
|
||||||
link_post_id: reflected_post.try(:id),
|
link_post_id: reflected_post.try(:id),
|
||||||
quote: link.is_quote)
|
quote: link.is_quote)
|
||||||
|
end
|
||||||
|
|
||||||
# Create the reflection if we can
|
# Create the reflection if we can
|
||||||
if topic_id.present?
|
if topic_id.present?
|
||||||
|
|
Loading…
Reference in a new issue