Fix some rubocop style issues (#5730)

master
Eugen Rochko 7 years ago committed by Yamagishi Kazutoshi
parent 2151fd3150
commit 3e90987c8b
  1. 2
      app/controllers/application_controller.rb
  2. 2
      app/controllers/auth/sessions_controller.rb
  3. 2
      app/helpers/admin/filter_helper.rb
  4. 3
      app/lib/extractor.rb
  5. 4
      app/models/web/push_subscription.rb
  6. 2
      app/services/batched_remove_status_service.rb
  7. 4
      app/services/resolve_remote_account_service.rb

@ -104,7 +104,7 @@ class ApplicationController < ActionController::Base
unless uncached_ids.empty?
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)
end
end

@ -62,7 +62,7 @@ class Auth::SessionsController < Devise::SessionsController
if user_params[:otp_attempt].present? && session[:otp_user_id]
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)
end
end

@ -18,7 +18,7 @@ module Admin::FilterHelper
def selected?(more_params)
new_url = filtered_url_for(more_params)
filter_link_class(new_url) == 'selected' ? true : false
filter_link_class(new_url) == 'selected'
end
private

@ -5,7 +5,8 @@ module Extractor
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]
possible_entries = []

@ -24,12 +24,12 @@ class Web::PushSubscription < ApplicationRecord
end
def pushable?(notification)
data && data.key?('alerts') && data['alerts'][notification.type.to_s]
data&.key?('alerts') && data['alerts'][notification.type.to_s]
end
def as_payload
payload = { id: id, endpoint: endpoint }
payload[:alerts] = data['alerts'] if data && data.key?('alerts')
payload[:alerts] = data['alerts'] if data&.key?('alerts')
payload
end

@ -26,7 +26,7 @@ class BatchedRemoveStatusService < BaseService
statuses.each(&:destroy)
# 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
unpush_from_home_timelines(account, account_statuses)

@ -124,11 +124,11 @@ class ResolveRemoteAccountService < BaseService
end
def auto_suspend?
domain_block && domain_block.suspend?
domain_block&.suspend?
end
def auto_silence?
domain_block && domain_block.silence?
domain_block&.silence?
end
def domain_block

Loading…
Cancel
Save