Re-add missing transaction around status-from-OStatus creation (#4603)
This commit is contained in:
		
							parent
							
								
									83b48812e4
								
							
						
					
					
						commit
						5bd2dcd436
					
				
					 1 changed files with 21 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -16,11 +16,14 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
 | 
			
		|||
 | 
			
		||||
    return [status, false] unless status.nil?
 | 
			
		||||
 | 
			
		||||
    cached_reblog = reblog
 | 
			
		||||
 | 
			
		||||
    ApplicationRecord.transaction do
 | 
			
		||||
      status = Status.create!(
 | 
			
		||||
        uri: id,
 | 
			
		||||
        url: url,
 | 
			
		||||
        account: @account,
 | 
			
		||||
      reblog: reblog,
 | 
			
		||||
        reblog: cached_reblog,
 | 
			
		||||
        text: content,
 | 
			
		||||
        spoiler_text: content_warning,
 | 
			
		||||
        created_at: published,
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +37,7 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
 | 
			
		|||
      save_mentions(status)
 | 
			
		||||
      save_hashtags(status)
 | 
			
		||||
      save_media(status)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if thread? && status.thread.nil?
 | 
			
		||||
      Rails.logger.debug "Trying to attach #{status.id} (#{id}) to #{thread.first}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue