Resolve remote accounts when mentioned even if they are already known (#5539)
This commit reduces the risk of not having up-to-date public key or protocol information for a remote account, which is required to deliver toots (especially direct messages).
This commit is contained in:
		
							parent
							
								
									47b0c61853
								
							
						
					
					
						commit
						7bea1530f4
					
				
					 1 changed files with 4 additions and 9 deletions
				
			
		| 
						 | 
					@ -11,15 +11,10 @@ class ProcessMentionsService < BaseService
 | 
				
			||||||
    return unless status.local?
 | 
					    return unless status.local?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    status.text.scan(Account::MENTION_RE).each do |match|
 | 
					    status.text.scan(Account::MENTION_RE).each do |match|
 | 
				
			||||||
      username, domain  = match.first.split('@')
 | 
					      begin
 | 
				
			||||||
      mentioned_account = Account.find_remote(username, domain)
 | 
					        mentioned_account = resolve_remote_account_service.call(match.first.to_s)
 | 
				
			||||||
 | 
					      rescue Goldfinger::Error, HTTP::Error
 | 
				
			||||||
      if mentioned_account.nil? && !domain.nil?
 | 
					        mentioned_account = nil
 | 
				
			||||||
        begin
 | 
					 | 
				
			||||||
          mentioned_account = resolve_remote_account_service.call(match.first.to_s)
 | 
					 | 
				
			||||||
        rescue Goldfinger::Error, HTTP::Error
 | 
					 | 
				
			||||||
          mentioned_account = nil
 | 
					 | 
				
			||||||
        end
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      next if mentioned_account.nil?
 | 
					      next if mentioned_account.nil?
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue