- var likes = ~comment.upvotes.map(function(v) { return v.author; }).indexOf(citizen.id)
- var dislikes = ~comment.downvotes.map(function(v) { return v.author; }).indexOf(citizen.id)
- var flags = ~comment.flags.map(function(v) { return v.author; }).indexOf(citizen.id)
- var own = comment.author.id == citizen.id
- var length = comment.replies.length
- if (config['spam limit'])
  - var spam = comment.flags.length > config['spam limit']
- else
  - var spam = comment.flags.length > (comment.upvotes.length - comment.downvotes.length)

mixin remove-action(length)
  - var hide = length && !citizen.staff ? 'hide' : ''
  a.comment-action.link-remove.btn-remove(href="#", title=t('Remove argument'), class=hide)
    i.icon-remove

li.media.comment-item(data-id=comment.id, class=spam ? 'spam' : '', class=own ? 'own' : '')
  span.pull-left
    - var src = comment.author.profilePictureUrl ? comment.author.profilePictureUrl : comment.author.gravatar
    img(src=src).avatar

  .media-body
    h5.media-heading
      - if (!own)
        - var classes = []
        - flags && classes.push('selected')
        - !citizen.id && classes.push('hide')
        - var spamTitle = flags ?  t('Not spam') : t('Spam')
        - if (citizen.staff)
          +remove-action(length)
        a.comment-action.link-report.flag(href="#", title=spamTitle, class=classes)
          i.glyphicon.glyphicon-flag
          span.count=comment.flags.length ? comment.flags.length : ''
      - else
        +remove-action(length)
        a.comment-action.link-edit.btn-edit(href="#", title=t('comments.edit.argument'))
          i.icon-pencil

      | #{comment.author.fullName} 
      small.ago(data-time=comment.createdAt.toString())
      - if (comment.editedAt)
        small.edited · #{t('comments.edited')}
      small=':'
    .comment-body
      div.comment-text!=markdown(comment.text)
      - if (own || citizen.staff)
        div.oncomment.remove-comment= t('comments.arguments.confirm-remove')
          -if (!own && citizen.staff)
            br
            =t('You are removing this argument as a staff member')
          div.remove-confirm-actions
            a.confirm-remove(href='#')= t('common.ok')
            a.cancel-remove(href='#')= t('common.cancel')
      div.oncomment.message
      p.spam-message=t('This argument has been flagged as spam')
        | .
        span.show-spam: a(href="#")= t('show')
      .comment-actions
        span.comment-counter=(comment.upvotes.length - comment.downvotes.length)
        - var classes = []
        - likes && classes.push('selected')
        //- - !citizen.id && classes.push('hide')
        a.comment-action.vote-comment.like(href="#", title=t('Upvote'), class=classes)
          i.icon-angle-up
          //span.label Aports
        - var classes = []
        - dislikes && classes.push('selected')
        //- - !citizen.id && classes.push('hide')
        a.comment-action.vote-comment.dislike(href="#", title=t('Downvote'), class=classes)
          i.icon-angle-down
        - if (length || citizen.id)
          - var title = length + ' ' + (length > 1 ? t('comments.replies') : t('comments.reply'))
          a.comment-action.comment-reply.pull-right(href='#', title=title.toLowerCase())
            span.reply-counter= length > 0 ? length : ''
          a.comment-action.comment-reply.pull-right(href='#', title=t('comments.reply-to-argument'))
            i.icon-reply
      span.error
  .replies-container