0
0

attach_media should be in transaction of creation status (#2426)

This commit is contained in:
Keiji, Yoshimi 2017-04-26 10:47:44 +09:00 committed by Eugen Rochko
parent 8ee1af9530
commit 8fe36654ef

View File

@ -20,15 +20,17 @@ class PostStatusService < BaseService
end end
media = validate_media!(options[:media_ids]) media = validate_media!(options[:media_ids])
status = account.statuses.create!(text: text, status = nil
thread: in_reply_to, ApplicationRecord.transaction do
sensitive: options[:sensitive], status = account.statuses.create!(text: text,
spoiler_text: options[:spoiler_text] || '', thread: in_reply_to,
visibility: options[:visibility], sensitive: options[:sensitive],
language: detect_language_for(text, account), spoiler_text: options[:spoiler_text] || '',
application: options[:application]) visibility: options[:visibility],
language: detect_language_for(text, account),
attach_media(status, media) application: options[:application])
attach_media(status, media)
end
process_mentions_service.call(status) process_mentions_service.call(status)
process_hashtags_service.call(status) process_hashtags_service.call(status)