<commit_before>class SidebarMessageItem extends SidebarItem

  JView.mixin @prototype

  constructor: (options = {}, data) ->

    options.type     = 'member'
    options.cssClass = 'kdlistitemview-sidebar-item'
    options.route    = "Message/#{data.id}"

    super options, data

    data = @getData()

    for account in data.participantsPreview when account._id isnt KD.userAccount._id
      origin = constructorName : 'JAccount', id : account._id
      break

    @actor = new ProfileTextView {origin}

    # we need a multiple avatarview here
    @avatar = new AvatarStaticView
      size       : width : 24, height : 24
      cssClass   : "avatarview"
      showStatus : yes
      origin     : origin


  pistachio: -> "{{> @avatar}}{{> @actor}}{{> @unreadCount}}"<commit_msg>Client: fix bug where pm to themselves have no avatars in sidebar<commit_after>class SidebarMessageItem extends SidebarItem

  JView.mixin @prototype

  constructor: (options = {}, data) ->

    options.type     = 'member'
    options.cssClass = 'kdlistitemview-sidebar-item'
    options.route    = "Message/#{data.id}"

    super options, data

    data = @getData()

    # users can send messages to themselves and to others; if they're others
    # show their avatars, fallback to user's avatar if they're the only one
    if data.participantsPreview.length is 1
      origin = data.participantsPreview[0]
    else
      for account in data.participantsPreview when account._id isnt KD.userAccount._id
        origin = account
        break

    origin = constructorName : 'JAccount', id : origin._id

    @actor = new ProfileTextView {origin}

    # we need a multiple avatarview here
    @avatar = new AvatarStaticView
      size       : width : 24, height : 24
      cssClass   : "avatarview"
      showStatus : yes
      origin     : origin


  pistachio: -> "{{> @avatar}}{{> @actor}}{{> @unreadCount}}"
{'fraction_non_alphanumeric': 0.10084477296726505, 'fraction_numerical': 0.005279831045406547, 'mean_word_length': 2.843813387423935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4326027', 'n_tokens_mistral': 584, 'n_tokens_neox': 544, 'n_words': 167}