<commit_before>class Authentication < ActiveRecord::Base
  include Concerns::OmniauthConcern
  include Concerns::UserImagesConcern

  belongs_to :user

  validates :user_id, :provider, :proid, presence: true

  def name
    oauth_data ? (oauth_data['name'] || "#{oauth_data['first_name']} oauth_data['last_name']") : nil
  end

  def profile_url
    oauth_data.try(:[], 'profile_url')
  end
end<commit_msg>Add display_name to authentication<commit_after>class Authentication < ActiveRecord::Base
  include Concerns::OmniauthConcern
  include Concerns::UserImagesConcern

  belongs_to :user

  validates :user_id, :provider, :proid, presence: true

  def name
    return nil unless oauth_data
    oauth_data['name'].presence || "#{oauth_data['first_name']} #{oauth_data['last_name']}".strip.presence || nil
  end

  def display_name
    return nil unless oauth_data
    oauth_data['first_name'].presence || oauth_data['nickname'].presence || oauth_data['name'].presence || oauth_data['username'].presence || nil
  end

  def profile_url
    oauth_data.try(:[], 'profile_url')
  end
end
{'fraction_non_alphanumeric': 0.12177121771217712, 'fraction_numerical': 0.0, 'mean_word_length': 5.458333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4484082', 'n_tokens_mistral': 374, 'n_tokens_neox': 360, 'n_words': 75}