<commit_before>kd                   = require 'kd'
ActivityAppView      = require './activityappview'
ActivityFlux         = require 'activity/flux'
remote               = require('app/remote').getInstance()
globals              = require 'globals'
getGroup             = require 'app/util/getGroup'
checkFlag            = require 'app/util/checkFlag'
isKoding             = require 'app/util/isKoding'
AppStorage           = require 'app/appstorage'
AppController        = require 'app/appcontroller'
KodingAppsController = require 'app/kodingappscontroller'
keyboardKeys = require 'app/util/keyboardKeys'

require('./routehandler')()

module.exports = class ActivityAppController extends AppController

  @options = require './options'

  {noop} = kd

  FIRST_FETCH = yes

  constructor: (options = {}) ->

    options.view    = new ActivityAppView testPath : 'activity-feed'
    options.appInfo = name : 'Activity'

    super options

    {appStorageController} = kd.singletons

    @appStorage = appStorageController.storage 'Activity', '2.0'

    helper.loadFonts()
    helper.loadEmojiStyles()


  post: (options = {}, callback = noop) ->

    {socialapi} = kd.singletons

    socialapi.message.post options, callback


  edit: (options = {}, callback = noop) ->

    {id, body, payload} = options
    {socialapi} = kd.singletons

    socialapi.message.edit {id, body, payload}, callback


  reply: (options = {}, callback = noop) ->

    {activity, body, clientRequestId, payload} = options
<commit_msg>activity: unset threads when frontapp changes from activity<commit_after>kd                   = require 'kd'
ActivityAppView      = require './activityappview'
ActivityFlux         = require 'activity/flux'
remote               = require('app/remote').getInstance()
globals              = require 'globals'
getGroup             = require 'app/util/getGroup'
checkFlag            = require 'app/util/checkFlag'
isKoding             = require 'app/util/isKoding'
AppStorage           = require 'app/appstorage'
AppController        = require 'app/appcontroller'
KodingAppsController = require 'app/kodingappscontroller'
keyboardKeys = require 'app/util/keyboardKeys'

require('./routehandler')()

module.exports = class ActivityAppController extends AppController

  @options = require './options'

  {noop} = kd

  FIRST_FETCH = yes

  constructor: (options = {}) ->

    options.view    = new ActivityAppView testPath : 'activity-feed'
    options.appInfo = name : 'Activity'

    super options

    {appStorageController, appManager} = kd.singletons

    unless isKoding()
      appManager.on 'FrontAppIsChanged', (currentApp, oldApp) =>
        if currentApp isnt oldApp and oldApp is this
          {thread, message} = ActivityFlux.actions
          thread.changeSelectedThread null
          message.changeSelectedMessage null

    @appStorage = appStorageController.storage 'Activity', '2.0'

    helper.loadFonts()
    helper.loadEmojiStyles()


  post: (options = {}, callback = noop) ->

    {socialapi} = kd.singletons

    socialapi.message.post options, callback


  edit: (options = {}, callback = noop) ->

    {id, body, payload} = options
    {socialapi} = kd.singletons

    socialapi.message.edit {id, body, payload}, callback


  reply: (options = {}, callback = noop) ->

    {activity, body, clientRequestId, payload} = options

{'fraction_non_alphanumeric': 0.11078022632519356, 'fraction_numerical': 0.0011911852293031567, 'mean_word_length': 2.9564193168433452, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '3808136', 'n_tokens_mistral': 984, 'n_tokens_neox': 931, 'n_words': 231}