Re-add missing transaction around status-from-OStatus creation (#4603)

main
Eugen Rochko 7 years ago committed by GitHub
parent a855956185
commit 4fcbb1f838

@ -16,24 +16,28 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
return [status, false] unless status.nil? return [status, false] unless status.nil?
status = Status.create!( cached_reblog = reblog
uri: id,
url: url, ApplicationRecord.transaction do
account: @account, status = Status.create!(
reblog: reblog, uri: id,
text: content, url: url,
spoiler_text: content_warning, account: @account,
created_at: published, reblog: cached_reblog,
reply: thread?, text: content,
language: content_language, spoiler_text: content_warning,
visibility: visibility_scope, created_at: published,
conversation: find_or_create_conversation, reply: thread?,
thread: thread? ? find_status(thread.first) : nil language: content_language,
) visibility: visibility_scope,
conversation: find_or_create_conversation,
save_mentions(status) thread: thread? ? find_status(thread.first) : nil
save_hashtags(status) )
save_media(status)
save_mentions(status)
save_hashtags(status)
save_media(status)
end
if thread? && status.thread.nil? if thread? && status.thread.nil?
Rails.logger.debug "Trying to attach #{status.id} (#{id}) to #{thread.first}" Rails.logger.debug "Trying to attach #{status.id} (#{id}) to #{thread.first}"

Loading…
Cancel
Save