Remove unused methods from User (#16616)

This commit is contained in:
Michael Kohl 2022-02-18 09:02:17 +07:00 committed by GitHub
parent dbcb6b6b69
commit f654d86739
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 22 deletions

View file

@ -527,10 +527,6 @@ class User < ApplicationRecord
email.present? && subscribed_to_email_follower_notifications?
end
def hotness_score
search_score
end
def authenticated_through?(provider_name)
return false unless Authentication::Providers.available?(provider_name)
return false unless Authentication::Providers.enabled?(provider_name)
@ -633,21 +629,6 @@ class User < ApplicationRecord
Spam::Handler.handle_user!(user: self)
end
# TODO: @citizen428 I don't want to completely remove this method yet, as we
# have similar methods in other models. But the previous implementation used
# three profile fields that we can't guarantee to exist across all Forems. So
# for now this method will just return an empty string.
def tag_keywords_for_search
""
end
# TODO: this can be removed once we migrate away from ES
def search_score
counts_score = (articles_count + comments_count + reactions_count + badge_achievements_count) * 10
score = (counts_score + tag_keywords_for_search.size) * reputation_modifier
score.to_i
end
def destroy_follows
follower_relationships = Follow.followable_user(id)
follower_relationships.destroy_all

View file

@ -5,7 +5,6 @@ module Search
attributes :id,
:comments_count,
:badge_achievements_count,
:hotness_score,
:last_comment_at,
:name,
:path,

View file

@ -10,8 +10,6 @@ module Search
DEFAULT_PER_PAGE = 60
MAX_PER_PAGE = 100
# User.search_score used to take employer related fields into account, but they have since been moved to profile
# and removed from fields that are searched against.
HOTNESS_SCORE_ORDER = Arel.sql(%{
(((articles_count + comments_count + reactions_count + badge_achievements_count) * 10) * reputation_modifier)
DESC