attach_media should be in transaction of creation status (#2426)
This commit is contained in:
parent
8ee1af9530
commit
8fe36654ef
@ -20,6 +20,8 @@ class PostStatusService < BaseService
|
|||||||
end
|
end
|
||||||
|
|
||||||
media = validate_media!(options[:media_ids])
|
media = validate_media!(options[:media_ids])
|
||||||
|
status = nil
|
||||||
|
ApplicationRecord.transaction do
|
||||||
status = account.statuses.create!(text: text,
|
status = account.statuses.create!(text: text,
|
||||||
thread: in_reply_to,
|
thread: in_reply_to,
|
||||||
sensitive: options[:sensitive],
|
sensitive: options[:sensitive],
|
||||||
@ -27,8 +29,8 @@ class PostStatusService < BaseService
|
|||||||
visibility: options[:visibility],
|
visibility: options[:visibility],
|
||||||
language: detect_language_for(text, account),
|
language: detect_language_for(text, account),
|
||||||
application: options[:application])
|
application: options[:application])
|
||||||
|
|
||||||
attach_media(status, media)
|
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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user