* Eliminate extra accounts select query from FollowService * Optimistically update follow state in web UI and hide loading bar Fix #6205 * Asynchronize NotifyService in FollowService And fix failing test * Skip Webfinger resolve routine when called from FollowService if possible If an account is ActivityPub, then webfinger re-resolving is not necessary when called from FollowService. Improve options of ResolveAccountService
		
			
				
	
	
		
			19 lines
		
	
	
	
		
			546 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
	
		
			546 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
# frozen_string_literal: true
 | 
						|
 | 
						|
class LocalNotificationWorker
 | 
						|
  include Sidekiq::Worker
 | 
						|
 | 
						|
  def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
 | 
						|
    if activity_id.nil? && activity_class_name.nil?
 | 
						|
      activity = Mention.find(receiver_account_id)
 | 
						|
      receiver = activity.account
 | 
						|
    else
 | 
						|
      receiver = Account.find(receiver_account_id)
 | 
						|
      activity = activity_class_name.constantize.find(activity_id)
 | 
						|
    end
 | 
						|
 | 
						|
    NotifyService.new.call(receiver, activity)
 | 
						|
  rescue ActiveRecord::RecordNotFound
 | 
						|
    true
 | 
						|
  end
 | 
						|
end
 |