Fix specs.
This commit is contained in:
parent
95efdce74f
commit
191d2283f4
|
@ -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,15 +159,22 @@ 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
|
||||||
TopicLink.create!(post_id: post.id,
|
|
||||||
user_id: post.user_id,
|
topic_link = TopicLink.find_by(topic_id: post.topic_id,
|
||||||
topic_id: post.topic_id,
|
user_id: post.user_id,
|
||||||
url: url,
|
url: url)
|
||||||
domain: parsed.host || Discourse.current_hostname,
|
|
||||||
internal: internal,
|
unless topic_link
|
||||||
link_topic_id: topic_id,
|
TopicLink.create!(post_id: post.id,
|
||||||
link_post_id: reflected_post.try(:id),
|
user_id: post.user_id,
|
||||||
quote: link.is_quote)
|
topic_id: post.topic_id,
|
||||||
|
url: url,
|
||||||
|
domain: parsed.host || Discourse.current_hostname,
|
||||||
|
internal: internal,
|
||||||
|
link_topic_id: topic_id,
|
||||||
|
link_post_id: reflected_post.try(:id),
|
||||||
|
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 New Issue