Per user a list of collapsed nodes should be stored client side.
Initially this list needs to be passed to the js frontend.
Every folding/unfolding action updates this list in the client information.
Add a collapse / expand all function for the outliner as well for single nodes.