<commit_before>_ = require 'underscore'
React = require 'react'
{Actions,
 Utils,
 Thread,
 ArchiveThreadHelper,
 CategoryStore,
 ChangeFolderTask,
 ChangeLabelsTask,
 AccountStore} = require 'nylas-exports'

class ThreadListQuickActions extends React.Component
  @displayName: 'ThreadListQuickActions'
  @propTypes:
    thread: React.PropTypes.object
    categoryId: React.PropTypes.string

  render: =>
    actions = []
    actions.push <div key="reply" className="action action-reply" onClick={@_onReply}></div>
    actions.push <div key="fwd" className="action action-forward" onClick={@_onForward}></div>
    if @_shouldDisplayArchiveButton()
      actions.push <div key="archive" className="action action-archive" onClick={@_onArchive}></div>
    else if AccountStore.current().usesLabels() and @props.categoryId == CategoryStore.getStandardCategory('all').id
      actions.push <div key="trash" className="action action-trash" onClick={@_onTrash}></div>

    <div className="inner">
      {actions}
    </div>

  shouldComponentUpdate: (newProps, newState) ->
    newProps.thread.id isnt @props?.thread.id

  _shouldDisplayArchiveButton: =>
    if @props.categoryId != CategoryStore.getStandardCategory('archive')?.id and @props.categoryId != CategoryStore.getStandardCategory('trash')?.id
      if AccountStore.current().usesLabels()
        if @props.thread.labels.length == 1 and (@props.thread.labels[0].name == "archive" or @props.thread.labels[0].name == "all")
          return false
        return true
      else if @props.thread.folders.length == 1 and @props.thread.folders[0].name == "archive"
        return false
      return true

    return false
<commit_msg>Archive button no longer appears in sent folder<commit_after>_ = require 'underscore'
React = require 'react'
{Actions,
 Utils,
 Thread,
 ArchiveThreadHelper,
 CategoryStore,
 ChangeFolderTask,
 ChangeLabelsTask,
 AccountStore} = require 'nylas-exports'

class ThreadListQuickActions extends React.Component
  @displayName: 'ThreadListQuickActions'
  @propTypes:
    thread: React.PropTypes.object
    categoryId: React.PropTypes.string

  render: =>
    actions = []
    actions.push <div key="reply" className="action action-reply" onClick={@_onReply}></div>
    actions.push <div key="fwd" className="action action-forward" onClick={@_onForward}></div>
    if @_shouldDisplayArchiveButton()
      actions.push <div key="archive" className="action action-archive" onClick={@_onArchive}></div>
    else if AccountStore.current().usesLabels() and @props.categoryId == CategoryStore.getStandardCategory('all').id
      actions.push <div key="trash" className="action action-trash" onClick={@_onTrash}></div>

    <div className="inner">
      {actions}
    </div>

  shouldComponentUpdate: (newProps, newState) ->
    newProps.thread.id isnt @props?.thread.id

  _shouldDisplayArchiveButton: =>
    if @props.categoryId not in [CategoryStore.getStandardCategory('archive')?.id, CategoryStore.getStandardCategory('trash')?.id, CategoryStore.getStandardCategory('sent')?.id]
      if AccountStore.current().usesLabels()
        if @props.thread.labels.length == 1 and (@props.thread.labels[0].name == "archive" or @props.thread.labels[0].name == "all")
          return false
        return true
      else if @props.thread.folders.length == 1 and @props.thread.folders[0].name == "archive"
        return false
      return true

    return false

{'fraction_non_alphanumeric': 0.13276918587686024, 'fraction_numerical': 0.0029180040852057193, 'mean_word_length': 4.3730407523510975, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, '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': '1889574', 'n_tokens_mistral': 1004, 'n_tokens_neox': 982, 'n_words': 220}