<commit_before>class MessagesListItemView extends KDListItemView
  constructor:(options, data)->
    super

  partial:(data)->
    "<div>#{data.subject or '(No title)'}</div>"

class MessagesListView extends KDListView

class MessagesListController extends KDListViewController

  constructor:(options, data)->
    options.itemClass        or= InboxMessagesListItem
    options.listView            or= new MessagesListView
    options.startWithLazyLoader   = yes
    super options, data

    @getListView().registerListener
      KDEventTypes  : "AvatarPopupShouldBeHidden"
      listener      : @
      callback      : =>
        @propagateEvent KDEventType : 'AvatarPopupShouldBeHidden'

  fetchMessages:(callback)->
    appManager.tell 'Inbox', 'fetchMessages',
      # as          : 'recipient'
      limit       : 3
      sort        :
        timestamp : -1
    , (err, messages)=>
      # @propagateEvent KDEventType : "ClearMessagesListLoaderTimeout"
      @removeAllItems()
      @instantiateListItems messages

      unreadCount = 0
      for message in messages
        unreadCount++ unless message.flags_?.read

      @emit "MessageCountDidChange", unreadCount
      @hideLazyLoader()
      callback? err,messages

  fetchNotificationTeasers:(callback)->
    KD.whoami().fetchActivityTeasers? {
      targetName: $in: [
        # 'CActivity'
        'CReplieeBucketActivity'
        'CFolloweeBucketActivity'
        'CLikeeBucketActivity'
      ]
    }, {
      limit: 8
      sort:
        timestamp: -1
    }, (err, items)=>
      if err
        warn "There was a problem fetching notifications!",err
      else
        unglanced = items.filter (item)-> item.getFlagValue('glanced') isnt yes
        @emit 'NotificationCountDidChange', unglanced.length
        callback? items
      @hideLazyLoader()

class NotificationListItem extends KDListItemView

  activityNameMap = ->
    JStatusUpdate   : "your status update."
    JCodeSnip       : "your status update."
    JAccount        : "started following you."
    JPrivateMessage : "your private message."
    JComment        : "your comment."

  bucketNameMap = ->
    CReplieeBucketActivity  : "comment"
    CFolloweeBucketActivity : "follow"
    CLikeeBucketActivity    : "like"

  actionPhraseMap = ->
    comment : "commented on"
    reply   : "replied to"
    like    : "liked"<commit_msg>Add correct action messages for JOpinion and JDiscussion<commit_after>class MessagesListItemView extends KDListItemView
  constructor:(options, data)->
    super

  partial:(data)->
    "<div>#{data.subject or '(No title)'}</div>"

class MessagesListView extends KDListView

class MessagesListController extends KDListViewController

  constructor:(options, data)->
    options.itemClass        or= InboxMessagesListItem
    options.listView            or= new MessagesListView
    options.startWithLazyLoader   = yes
    super options, data

    @getListView().registerListener
      KDEventTypes  : "AvatarPopupShouldBeHidden"
      listener      : @
      callback      : =>
        @propagateEvent KDEventType : 'AvatarPopupShouldBeHidden'

  fetchMessages:(callback)->
    appManager.tell 'Inbox', 'fetchMessages',
      # as          : 'recipient'
      limit       : 3
      sort        :
        timestamp : -1
    , (err, messages)=>
      # @propagateEvent KDEventType : "ClearMessagesListLoaderTimeout"
      @removeAllItems()
      @instantiateListItems messages

      unreadCount = 0
      for message in messages
        unreadCount++ unless message.flags_?.read

      @emit "MessageCountDidChange", unreadCount
      @hideLazyLoader()
      callback? err,messages

  fetchNotificationTeasers:(callback)->
    KD.whoami().fetchActivityTeasers? {
      targetName: $in: [
        # 'CActivity'
        'CReplieeBucketActivity'
        'CFolloweeBucketActivity'
        'CLikeeBucketActivity'
      ]
    }, {
      limit: 8
      sort:
        timestamp: -1
    }, (err, items)=>
      if err
        warn "There was a problem fetching notifications!",err
      else
        unglanced = items.filter (item)-> item.getFlagValue('glanced') isnt yes
        @emit 'NotificationCountDidChange', unglanced.length
        callback? items
      @hideLazyLoader()

class NotificationListItem extends KDListItemView

  activityNameMap = ->
    JStatusUpdate   : "your status update."
    JCodeSnip       : "your status update."
    JAccount        : "started following you."
    JPrivateMessage : "your private message."
    JComment        : "your comment."
    JDiscussion     : "your discussion."
    JOpinion        : "your opinion."

  bucketNameMap = ->
    CReplieeBucketActivity  : "comment"
    CFolloweeBucketActivity : "follow"
    CLikeeBucketActivity    : "like"

  actionPhraseMap = ->
    comment : "commented on"
    reply   : "replied to"
    like    : "liked"
{'fraction_non_alphanumeric': 0.0916597853014038, 'fraction_numerical': 0.002064409578860446, 'mean_word_length': 2.62378459237098, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '5096321', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1343, 'n_words': 318}