<commit_before>module CacheKeysHelper

  def locale_and_user_status(authorable=nil)
    @cache_key_user ||= calculate_user_status(authorable)
    "#{I18n.locale}/#{@cache_key_user}"
  end

  def calculate_user_status(authorable=nil)
    user_status = "user"

    if user_signed_in?
      user_status += ":signed"
      user_status += ":verified" if current_user.verified_at.present?
      user_status += ":org" if current_user.organization?
      user_status += ":admin" if current_user.administrator?
      user_status += ":moderator" if current_user.moderator?
      user_status += ":author" if authorable && authorable.author == current_user
    else
      user_status += ":visitor"
    end

    user_status
  end

end<commit_msg>adds cache key for commendable without updated_at<commit_after>module CacheKeysHelper

  def locale_and_user_status(authorable=nil)
    @cache_key_user ||= calculate_user_status(authorable)
    "#{I18n.locale}/#{@cache_key_user}"
  end

  def calculate_user_status(authorable=nil)
    user_status = "user"

    if user_signed_in?
      user_status += ":signed"
      user_status += ":verified" if current_user.verified_at.present?
      user_status += ":org" if current_user.organization?
      user_status += ":admin" if current_user.administrator?
      user_status += ":moderator" if current_user.moderator?
      user_status += ":author" if authorable && authorable.author == current_user
    else
      user_status += ":visitor"
    end

    user_status
  end

  # when commentable id and type are used but no need to update cache on updated_at changes
  def commentable_cache_key(commentable)
    "#{commentable.class.name}-#{commentable.id}"
  end

end
{'fraction_non_alphanumeric': 0.10224586288416075, 'fraction_numerical': 0.002364066193853428, 'mean_word_length': 4.053731343283582, 'pattern_counts': {'":': 14, '<': 3, '<?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': '5302275', 'n_tokens_mistral': 544, 'n_tokens_neox': 535, 'n_words': 115}