 isGroupDisabled      = require 'app/util/isGroupDisabled'
 ContentModal         = require 'app/components/contentModal'
 runMiddlewares       = require 'app/util/runMiddlewares'
+SidebarFlux          = require 'app/flux/sidebar'
+whoami               = require 'app/util/whoami'
+
 TestMachineMiddleware = require './middlewares/testmachine'
 
-whoami = require 'app/util/whoami'
 
 { actions : HomeActions } = require 'home/flux'
 require './config'


    if stackTemplate
      reactor.dispatch 'UPDATE_PRIVATE_STACK_TEMPLATE_SUCCESS', { stackTemplate }
      reactor.dispatch 'MAKE_SIDEBAR_ITEM_VISIBLE_SUCCESS', { type: 'draft', id }

    stacks = @stacks.filter (stack) -> stack.config?.clonedFrom is id


    { reactor } = kd.singletons

    reactor.dispatch 'UPDATE_TEAM_STACK_TEMPLATE_SUCCESS', { stackTemplate }
    if whoami()._id is stackTemplate.originId
      SidebarFlux.actions.makeVisible 'draft', stackTemplate._id

    stacks = @stacks.filter (stack) ->
      stack.config?.clonedFrom is stackTemplate._id
