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

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

@ -16,11 +16,14 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
return [status, false] unless status.nil? return [status, false] unless status.nil?
cached_reblog = reblog
ApplicationRecord.transaction do
status = Status.create!( status = Status.create!(
uri: id, uri: id,
url: url, url: url,
account: @account, account: @account,
reblog: reblog, reblog: cached_reblog,
text: content, text: content,
spoiler_text: content_warning, spoiler_text: content_warning,
created_at: published, created_at: published,
@ -34,6 +37,7 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
save_mentions(status) save_mentions(status)
save_hashtags(status) save_hashtags(status)
save_media(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