<commit_before>class window.User extends Backbone.Model
  initialize: ->
    @following = new Following([], user: @)
    @following.on 'all', => @trigger 'follow_action'

  url: ->
    # We do this because we cannot (yet) set the idAttribute to "username"
    if @collection?
      @collection.url() + '/' + @get('username')
    else
      '/' + @get('username')

  avatar_url: (size) ->
    if(window.test_counter)
      'about:blank'
    else
      md5d_email = @get('gravatar_hash')
      "https://secure.gravatar.com/avatar/#{md5d_email}?size=#{size}&rating=PG&default=retro"

  link: -> "/#{@get('username')}"

  feed_activities: ->
    @_feed_activities ?= new UserActivities null, user: @

  toJSON: ->
    username = @get('username')
    _.extend super(),
      is_current_user: FactlinkApp.isCurrentUser(this),
      edit_path: "/#{username}/edit",
      change_password_path: "/#{username}/password/edit"
      notifications_settings_path: "/#{username}/notification-settings"
      link: @link()
      avatar_url_24: @avatar_url(24)
      avatar_url_32: @avatar_url(32)
      avatar_url_48: @avatar_url(48)
      avatar_url_80: @avatar_url(80)

  is_following_users: ->
    !@following.isEmpty()

  follow: ->
    currentUser.following.create @,
      error: =>
        currentUser.following.remove @
        @set 'statistics_follower_count', @get('statistics_follower_count')-1

    @set 'statistics_follower_count', @get('statistics_follower_count')+1
    @trigger 'followed'<commit_msg>Removed avatar fields from toJSON<commit_after>class window.User extends Backbone.Model
  initialize: ->
    @following = new Following([], user: @)
    @following.on 'all', => @trigger 'follow_action'

  url: ->
    # We do this because we cannot (yet) set the idAttribute to "username"
    if @collection?
      @collection.url() + '/' + @get('username')
    else
      '/' + @get('username')

  avatar_url: (size) ->
    if(window.test_counter)
      'about:blank'
    else
      md5d_email = @get('gravatar_hash')
      "https://secure.gravatar.com/avatar/#{md5d_email}?size=#{size}&rating=PG&default=retro"

  link: -> "/#{@get('username')}"

  feed_activities: ->
    @_feed_activities ?= new UserActivities null, user: @

  toJSON: ->
    username = @get('username')
    _.extend super(),
      is_current_user: FactlinkApp.isCurrentUser(this),
      edit_path: "/#{username}/edit",
      change_password_path: "/#{username}/password/edit"
      notifications_settings_path: "/#{username}/notification-settings"
      link: @link()

  is_following_users: ->
    !@following.isEmpty()

  follow: ->
    currentUser.following.create @,
      error: =>
        currentUser.following.remove @
        @set 'statistics_follower_count', @get('statistics_follower_count')-1

    @set 'statistics_follower_count', @get('statistics_follower_count')+1
    @trigger 'followed'
{'fraction_non_alphanumeric': 0.15459610027855153, 'fraction_numerical': 0.008356545961002786, 'mean_word_length': 3.510204081632653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, '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': '7469552', 'n_tokens_mistral': 990, 'n_tokens_neox': 948, 'n_words': 167}