<commit_before>checkFlag = require '../../util/checkFlag'
kd = require 'kd'
KDCustomHTMLView = kd.CustomHTMLView
AvatarTooltipView = require '../avatarviews/avatartooltipview'
JView = require '../../jview'
LinkView = require './linkview'


module.exports = class ProfileLinkView extends LinkView

  JView.mixin @prototype

  constructor:(options = {}, data)->
    options.noTooltip ?= yes

    # this needs to be pre-super
    unless options.noTooltip
      @avatarPreview =
        constructorName : AvatarTooltipView
        options         :
          delegate      : @
          origin        : options.origin
        data            : data

    if @avatarPreview then options.tooltip or=
      view             : unless options.noTooltip then @avatarPreview else null
      cssClass         : 'avatar-tooltip'
      animate          : yes
      placement        : 'top'#['top','bottom','right','left'][Math.floor(Math.random()*4)]
      direction        : 'left'#['left','right','center','top','bottom'][Math.floor(Math.random()*5)]

    super options, data
    if @avatarPreview?
      @on 'TooltipReady', =>
        kd.utils.defer =>
          @tooltip?.getView()?.updateData @getData() if @getData()?.profile.nickname?

    @troll = new KDCustomHTMLView
      tagName   : 'span'

    @setClass "profile"
    @updateHref()


  updateHref: ->
    { payload } = @getOptions()
    nickname = @getData().profile?.nickname
    href = if payload?.channelIntegrationId then "/Admin/Integrations/Configure/#{payload.channelIntegrationId}"
    else if nickname then "/#{nickname}"<commit_msg>App: add non-link href to team profile links<commit_after>checkFlag = require '../../util/checkFlag'
kd = require 'kd'
KDCustomHTMLView = kd.CustomHTMLView
AvatarTooltipView = require '../avatarviews/avatartooltipview'
JView = require '../../jview'
LinkView = require './linkview'
isKoding = require 'app/util/isKoding'


module.exports = class ProfileLinkView extends LinkView

  JView.mixin @prototype

  constructor:(options = {}, data)->
    options.noTooltip ?= yes

    # this needs to be pre-super
    unless options.noTooltip
      @avatarPreview =
        constructorName : AvatarTooltipView
        options         :
          delegate      : @
          origin        : options.origin
        data            : data

    if @avatarPreview then options.tooltip or=
      view             : unless options.noTooltip then @avatarPreview else null
      cssClass         : 'avatar-tooltip'
      animate          : yes
      placement        : 'top'#['top','bottom','right','left'][Math.floor(Math.random()*4)]
      direction        : 'left'#['left','right','center','top','bottom'][Math.floor(Math.random()*5)]

    super options, data
    if @avatarPreview?
      @on 'TooltipReady', =>
        kd.utils.defer =>
          @tooltip?.getView()?.updateData @getData() if @getData()?.profile.nickname?

    @troll = new KDCustomHTMLView
      tagName   : 'span'

    @setClass "profile"
    @updateHref()


  updateHref: ->
    { payload } = @getOptions()
    nickname = @getData().profile?.nickname

    href = if payload?.channelIntegrationId
      "/Admin/Integrations/Configure/#{payload.channelIntegrationId}"
    else
      if isKoding() and nickname
      then "/#{nickname}"
      else "/#"

{'fraction_non_alphanumeric': 0.13076456310679613, 'fraction_numerical': 0.0012135922330097086, 'mean_word_length': 2.595419847328244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '675613', 'n_tokens_mistral': 958, 'n_tokens_neox': 956, 'n_words': 209}