Fix some rubocop style issues (#5730)
parent
21d01d5809
commit
3df46ce5a8
|
@ -104,7 +104,7 @@ class ApplicationController < ActionController::Base
|
||||||
unless uncached_ids.empty?
|
unless uncached_ids.empty?
|
||||||
uncached = klass.where(id: uncached_ids).with_includes.map { |item| [item.id, item] }.to_h
|
uncached = klass.where(id: uncached_ids).with_includes.map { |item| [item.id, item] }.to_h
|
||||||
|
|
||||||
uncached.values.each do |item|
|
uncached.each_value do |item|
|
||||||
Rails.cache.write(item.cache_key, item)
|
Rails.cache.write(item.cache_key, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Auth::SessionsController < Devise::SessionsController
|
||||||
|
|
||||||
if user_params[:otp_attempt].present? && session[:otp_user_id]
|
if user_params[:otp_attempt].present? && session[:otp_user_id]
|
||||||
authenticate_with_two_factor_via_otp(user)
|
authenticate_with_two_factor_via_otp(user)
|
||||||
elsif user && user.valid_password?(user_params[:password])
|
elsif user&.valid_password?(user_params[:password])
|
||||||
prompt_for_two_factor(user)
|
prompt_for_two_factor(user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ module Admin::FilterHelper
|
||||||
|
|
||||||
def selected?(more_params)
|
def selected?(more_params)
|
||||||
new_url = filtered_url_for(more_params)
|
new_url = filtered_url_for(more_params)
|
||||||
filter_link_class(new_url) == 'selected' ? true : false
|
filter_link_class(new_url) == 'selected'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -5,7 +5,8 @@ module Extractor
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def extract_mentions_or_lists_with_indices(text) # :yields: username, list_slug, start, end
|
# :yields: username, list_slug, start, end
|
||||||
|
def extract_mentions_or_lists_with_indices(text)
|
||||||
return [] unless text =~ Twitter::Regex[:at_signs]
|
return [] unless text =~ Twitter::Regex[:at_signs]
|
||||||
|
|
||||||
possible_entries = []
|
possible_entries = []
|
||||||
|
|
|
@ -24,12 +24,12 @@ class Web::PushSubscription < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def pushable?(notification)
|
def pushable?(notification)
|
||||||
data && data.key?('alerts') && data['alerts'][notification.type.to_s]
|
data&.key?('alerts') && data['alerts'][notification.type.to_s]
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_payload
|
def as_payload
|
||||||
payload = { id: id, endpoint: endpoint }
|
payload = { id: id, endpoint: endpoint }
|
||||||
payload[:alerts] = data['alerts'] if data && data.key?('alerts')
|
payload[:alerts] = data['alerts'] if data&.key?('alerts')
|
||||||
payload
|
payload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class BatchedRemoveStatusService < BaseService
|
||||||
statuses.each(&:destroy)
|
statuses.each(&:destroy)
|
||||||
|
|
||||||
# Batch by source account
|
# Batch by source account
|
||||||
statuses.group_by(&:account_id).each do |_, account_statuses|
|
statuses.group_by(&:account_id).each_value do |account_statuses|
|
||||||
account = account_statuses.first.account
|
account = account_statuses.first.account
|
||||||
|
|
||||||
unpush_from_home_timelines(account, account_statuses)
|
unpush_from_home_timelines(account, account_statuses)
|
||||||
|
|
|
@ -124,11 +124,11 @@ class ResolveRemoteAccountService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def auto_suspend?
|
def auto_suspend?
|
||||||
domain_block && domain_block.suspend?
|
domain_block&.suspend?
|
||||||
end
|
end
|
||||||
|
|
||||||
def auto_silence?
|
def auto_silence?
|
||||||
domain_block && domain_block.silence?
|
domain_block&.silence?
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_block
|
def domain_block
|
||||||
|
|
Loading…
Reference in New Issue