mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
FIX: Incorrect scope when checking for existing topic link.
This commit is contained in:
parent
e1cfe7536c
commit
bf64280661
@ -161,7 +161,7 @@ class TopicLink < ActiveRecord::Base
|
||||
added_urls << url
|
||||
|
||||
topic_link = TopicLink.find_by(topic_id: post.topic_id,
|
||||
user_id: post.user_id,
|
||||
post_id: post.id,
|
||||
url: url)
|
||||
|
||||
unless topic_link
|
||||
|
@ -121,6 +121,16 @@ http://b.com/#{'a'*500}
|
||||
expect(reflection.user_id).to eq(link.user_id)
|
||||
end
|
||||
|
||||
PostOwnerChanger.new(
|
||||
post_ids: [linked_post.id],
|
||||
topic_id: topic.id,
|
||||
acting_user: user,
|
||||
new_owner: Fabricate(:user)
|
||||
).change_owner!
|
||||
|
||||
TopicLink.extract_from(linked_post)
|
||||
expect(topic.topic_links.first.url).to eq(url)
|
||||
|
||||
linked_post.revise(post.user, { raw: "no more linkies https://eviltrout.com" })
|
||||
expect(other_topic.topic_links.where(link_post_id: linked_post.id)).to be_blank
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user