mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00:00
Raise an error if create fails.
This commit is contained in:
parent
494f1f9fae
commit
8c3e63f87a
@ -159,7 +159,7 @@ 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,
|
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,
|
||||||
url: url,
|
url: url,
|
||||||
@ -184,7 +184,7 @@ class TopicLink < ActiveRecord::Base
|
|||||||
url: reflected_url)
|
url: reflected_url)
|
||||||
|
|
||||||
unless tl
|
unless tl
|
||||||
tl = TopicLink.create(user_id: post.user_id,
|
tl = TopicLink.create!(user_id: post.user_id,
|
||||||
topic_id: topic_id,
|
topic_id: topic_id,
|
||||||
post_id: reflected_post.try(:id),
|
post_id: reflected_post.try(:id),
|
||||||
url: reflected_url,
|
url: reflected_url,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user