Fix Rails/FindEach cop (#26886)
				
					
				
			This commit is contained in:
		
							parent
							
								
									fe26f33e0a
								
							
						
					
					
						commit
						0c4e7c06dc
					
				@ -246,7 +246,7 @@ class FeedManager
 | 
				
			|||||||
  # @param [Account] target_account
 | 
					  # @param [Account] target_account
 | 
				
			||||||
  # @return [void]
 | 
					  # @return [void]
 | 
				
			||||||
  def clear_from_lists(account, target_account)
 | 
					  def clear_from_lists(account, target_account)
 | 
				
			||||||
    List.where(account: account).each do |list|
 | 
					    List.where(account: account).find_each do |list|
 | 
				
			||||||
      clear_from_list(list, target_account)
 | 
					      clear_from_list(list, target_account)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,7 @@ class ActivityPub::FetchFeaturedTagsCollectionService < BaseService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    FeaturedTag.includes(:tag).references(:tag).where(account: @account).where.not(tag: { name: normalized_names }).delete_all
 | 
					    FeaturedTag.includes(:tag).references(:tag).where(account: @account).where.not(tag: { name: normalized_names }).delete_all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FeaturedTag.includes(:tag).references(:tag).where(account: @account, tag: { name: normalized_names }).each do |featured_tag|
 | 
					    FeaturedTag.includes(:tag).references(:tag).where(account: @account, tag: { name: normalized_names }).find_each do |featured_tag|
 | 
				
			||||||
      featured_tag.update(name: tags.delete(featured_tag.tag.name))
 | 
					      featured_tag.update(name: tags.delete(featured_tag.tag.name))
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,7 @@ class ActivityPub::SynchronizeFollowersService < BaseService
 | 
				
			|||||||
  private
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def remove_unexpected_local_followers!
 | 
					  def remove_unexpected_local_followers!
 | 
				
			||||||
    @account.followers.local.where.not(id: @expected_followers.map(&:id)).each do |unexpected_follower|
 | 
					    @account.followers.local.where.not(id: @expected_followers.map(&:id)).reorder(nil).find_each do |unexpected_follower|
 | 
				
			||||||
      UnfollowService.new.call(unexpected_follower, @account)
 | 
					      UnfollowService.new.call(unexpected_follower, @account)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
@ -22,7 +22,7 @@ class AppealService < BaseService
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def notify_staff!
 | 
					  def notify_staff!
 | 
				
			||||||
    User.those_who_can(:manage_appeals).includes(:account).each do |u|
 | 
					    User.those_who_can(:manage_appeals).includes(:account).find_each do |u|
 | 
				
			||||||
      AdminMailer.with(recipient: u.account).new_appeal(@appeal).deliver_later if u.allows_appeal_emails?
 | 
					      AdminMailer.with(recipient: u.account).new_appeal(@appeal).deliver_later if u.allows_appeal_emails?
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
@ -53,7 +53,7 @@ class ApproveAppealService < BaseService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  def undo_mark_statuses_as_sensitive!
 | 
					  def undo_mark_statuses_as_sensitive!
 | 
				
			||||||
    representative_account = Account.representative
 | 
					    representative_account = Account.representative
 | 
				
			||||||
    @strike.statuses.includes(:media_attachments).each do |status|
 | 
					    @strike.statuses.includes(:media_attachments).find_each do |status|
 | 
				
			||||||
      UpdateStatusService.new.call(status, representative_account.id, sensitive: false) if status.with_media?
 | 
					      UpdateStatusService.new.call(status, representative_account.id, sensitive: false) if status.with_media?
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ class ProcessHashtagsService < BaseService
 | 
				
			|||||||
    added_tags = @current_tags - @previous_tags
 | 
					    added_tags = @current_tags - @previous_tags
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unless added_tags.empty?
 | 
					    unless added_tags.empty?
 | 
				
			||||||
      @account.featured_tags.where(tag_id: added_tags.map(&:id)).each do |featured_tag|
 | 
					      @account.featured_tags.where(tag_id: added_tags.map(&:id)).find_each do |featured_tag|
 | 
				
			||||||
        featured_tag.increment(@status.created_at)
 | 
					        featured_tag.increment(@status.created_at)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@ -32,7 +32,7 @@ class ProcessHashtagsService < BaseService
 | 
				
			|||||||
    removed_tags = @previous_tags - @current_tags
 | 
					    removed_tags = @previous_tags - @current_tags
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unless removed_tags.empty?
 | 
					    unless removed_tags.empty?
 | 
				
			||||||
      @account.featured_tags.where(tag_id: removed_tags.map(&:id)).each do |featured_tag|
 | 
					      @account.featured_tags.where(tag_id: removed_tags.map(&:id)).find_each do |featured_tag|
 | 
				
			||||||
        featured_tag.decrement(@status.id)
 | 
					        featured_tag.decrement(@status.id)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
				
			|||||||
@ -114,7 +114,7 @@ class RemoveStatusService < BaseService
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def remove_from_hashtags
 | 
					  def remove_from_hashtags
 | 
				
			||||||
    @account.featured_tags.where(tag_id: @status.tags.map(&:id)).each do |featured_tag|
 | 
					    @account.featured_tags.where(tag_id: @status.tags.map(&:id)).find_each do |featured_tag|
 | 
				
			||||||
      featured_tag.decrement(@status.id)
 | 
					      featured_tag.decrement(@status.id)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,7 @@ class ReportService < BaseService
 | 
				
			|||||||
  def notify_staff!
 | 
					  def notify_staff!
 | 
				
			||||||
    return if @report.unresolved_siblings?
 | 
					    return if @report.unresolved_siblings?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    User.those_who_can(:manage_reports).includes(:account).each do |u|
 | 
					    User.those_who_can(:manage_reports).includes(:account).find_each do |u|
 | 
				
			||||||
      LocalNotificationWorker.perform_async(u.account_id, @report.id, 'Report', 'admin.report')
 | 
					      LocalNotificationWorker.perform_async(u.account_id, @report.id, 'Report', 'admin.report')
 | 
				
			||||||
      AdminMailer.with(recipient: u.account).new_report(@report).deliver_later if u.allows_report_emails?
 | 
					      AdminMailer.with(recipient: u.account).new_report(@report).deliver_later if u.allows_report_emails?
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user