<commit_before>class SidebarController extends KDViewController

  constructor:->
    super

    mainController = KD.getSingleton 'mainController'
    mainController.on 'ManageRemotes', -> new ManageRemotesModal
    mainController.on 'ManageDatabases', -> new ManageDatabasesModal
    mainController.on 'AccountChanged', @bound 'accountChanged'
    mainController.ready @bound 'accountChanged'

  accountChanged:(account)->
    account or= KD.whoami()
    {profile} = account
    sidebar   = @getView()

    {
     avatar, finderHeader, navController
     avatarAreaIconMenu, finderController
     footerMenuController, resourcesController
    } = sidebar

    avatar.setData account
    finderHeader.setData account
    # temp fix
    # this should be done on framework level
    # check comments on KDObject::setData
    avatar.render()
    finderHeader.render()

    navController.reset()
    footerMenuController.reset()
    @resetAdminNavItems()

    avatarAreaIconMenu.accountChanged account

    # get registered users vms all ready to go (don't for guests right now):
    finderController.reset()      if "registered" is account.type

    resourcesController.reset()

  resetAdminNavItems:->
    # return unless KD.isLoggedIn()<commit_msg>Fix the logic in SidebarController which triggers the FinderController reset to auto-mount vms<commit_after>class SidebarController extends KDViewController

  constructor:->
    super

    mainController = KD.getSingleton 'mainController'
    mainController.on 'ManageRemotes', -> new ManageRemotesModal
    mainController.on 'ManageDatabases', -> new ManageDatabasesModal
    mainController.on 'AccountChanged', @bound 'accountChanged'
    mainController.ready @bound 'accountChanged'

  accountChanged:(account)->
    account or= KD.whoami()
    {profile} = account
    sidebar   = @getView()

    {
     avatar, finderHeader, navController
     avatarAreaIconMenu, finderController
     footerMenuController, resourcesController
    } = sidebar

    avatar.setData account
    finderHeader.setData account
    # temp fix
    # this should be done on framework level
    # check comments on KDObject::setData
    avatar.render()
    finderHeader.render()

    navController.reset()
    footerMenuController.reset()
    @resetAdminNavItems()

    avatarAreaIconMenu.accountChanged account

    if KD.isLoggedIn()
      # get registered users vms
      # allready to go (don't for guests right now):
      finderController.reset()
      resourcesController.reset()

  resetAdminNavItems:->
    # return unless KD.isLoggedIn()
{'fraction_non_alphanumeric': 0.07850757870190439, 'fraction_numerical': 0.0, 'mean_word_length': 3.697080291970803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '529507', 'n_tokens_mistral': 730, 'n_tokens_neox': 673, 'n_words': 182}