mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Fix all the errors to get our tests green on Rails 5.1.
This commit is contained in:
@@ -214,17 +214,29 @@ SQL
|
||||
|
||||
# Remove links that aren't there anymore
|
||||
if added_urls.present?
|
||||
TopicLink.delete_all ["(url not in (:urls)) AND (post_id = :post_id AND NOT reflection)", urls: added_urls, post_id: post.id]
|
||||
TopicLink.where(
|
||||
"(url not in (:urls)) AND (post_id = :post_id AND NOT reflection)",
|
||||
urls: added_urls, post_id: post.id
|
||||
).delete_all
|
||||
|
||||
reflected_ids.compact!
|
||||
if reflected_ids.present?
|
||||
TopicLink.delete_all ["(id not in (:reflected_ids)) AND (link_post_id = :post_id AND reflection)",
|
||||
reflected_ids: reflected_ids, post_id: post.id]
|
||||
TopicLink.where(
|
||||
"(id not in (:reflected_ids)) AND (link_post_id = :post_id AND reflection)",
|
||||
reflected_ids: reflected_ids, post_id: post.id
|
||||
).delete_all
|
||||
else
|
||||
TopicLink.delete_all ["link_post_id = :post_id AND reflection", post_id: post.id]
|
||||
TopicLink
|
||||
.where("link_post_id = :post_id AND reflection", post_id: post.id)
|
||||
.delete_all
|
||||
end
|
||||
else
|
||||
TopicLink.delete_all ["(post_id = :post_id AND NOT reflection) OR (link_post_id = :post_id AND reflection)", post_id: post.id]
|
||||
TopicLink
|
||||
.where(
|
||||
"(post_id = :post_id AND NOT reflection) OR (link_post_id = :post_id AND reflection)",
|
||||
post_id: post.id
|
||||
)
|
||||
.delete_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user