Fix lints
This commit is contained in:
parent
92d5918b91
commit
fe9a77cd67
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UserController < ApplicationController
|
||||
before_action :set_user
|
||||
before_action :hidden_social_graph_redirect, only: %i[followers followings]
|
||||
|
@ -22,7 +24,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def followers
|
||||
@title = 'Followers'
|
||||
@title = "Followers"
|
||||
@relationships = @user.cursored_follower_relationships(last_id: params[:last_id])
|
||||
@relationships_last_id = @relationships.map(&:id).min
|
||||
@more_data_available = !@user.cursored_follower_relationships(last_id: @relationships_last_id, size: 1).count.zero?
|
||||
|
@ -35,9 +37,8 @@ class UserController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def followings
|
||||
@title = 'Following'
|
||||
@title = "Following"
|
||||
@relationships = @user.cursored_following_relationships(last_id: params[:last_id])
|
||||
@relationships_last_id = @relationships.map(&:id).min
|
||||
@more_data_available = !@user.cursored_following_relationships(last_id: @relationships_last_id, size: 1).count.zero?
|
||||
|
@ -49,10 +50,9 @@ class UserController < ApplicationController
|
|||
format.turbo_stream { render "show_follow" }
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def questions
|
||||
@title = 'Questions'
|
||||
@title = "Questions"
|
||||
@questions = @user.cursored_questions(author_is_anonymous: false, direct: belongs_to_current_user? || moderation_view?, last_id: params[:last_id])
|
||||
@questions_last_id = @questions.map(&:id).min
|
||||
@more_data_available = !@user.cursored_questions(author_is_anonymous: false, direct: belongs_to_current_user? || moderation_view?, last_id: @questions_last_id, size: 1).count.zero?
|
||||
|
@ -66,14 +66,14 @@ class UserController < ApplicationController
|
|||
private
|
||||
|
||||
def set_user
|
||||
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).includes(:profile).first!
|
||||
@user = User.where("LOWER(screen_name) = ?", params[:username].downcase).includes(:profile).first!
|
||||
end
|
||||
|
||||
def hidden_social_graph_redirect
|
||||
unless belongs_to_current_user? || !@user.privacy_hide_social_graph
|
||||
return if belongs_to_current_user? || !@user.privacy_hide_social_graph
|
||||
|
||||
redirect_to user_path(@user)
|
||||
end
|
||||
end
|
||||
|
||||
def belongs_to_current_user? = @user == current_user
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddPrivacyHideSocialGraph < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
add_column :users, :privacy_hide_social_graph, :boolean, default: false
|
||||
|
|
Loading…
Reference in New Issue