viewer/apiUsers.js
// removes a view from the user that created the view and adds it to the shared user
removes a view from the user that created the view and adds it to the shared user
removes a view from the user that created the view and adds it to the shared user
function shareView (req, res, user, endpoint, successMessage, errorMessage) {
    const view = user.views[req.body.name];
    view.shared = true;
    delete user.views[req.body.name]; 
    User.setUser(user.userId, user, (err, info) => {
      if (err) {
        console.log('ERROR - shareView -', endpoint, util.inspect(err, false, 50), info);
        return res.serverError(500, errorMessage);
      }
      return saveSharedView(req, res, user, view, endpoint, successMessage, errorMessage);
    });
  }
function shareView ( req , res , user , endpoint , successMessage , errorMessage ) { const view = user . views [ req . body . name ] ; view . shared = true ; delete user . views [ req . body . name ] ; User . setUser ( user . userId , user , ( err , info ) => { if ( err ) { console . log ( 'ERROR - shareView -' , endpoint , util . inspect ( err , false , 50 ) , info ) ; return res . serverError ( 500 , errorMessage ) ; } return saveSharedView ( req , res , user , view , endpoint , successMessage , errorMessage ) ; } ) ; }
removes a view from the user that created the view and adds it to the shared user
removes a view from the user that created the view and adds it to the shared user
// remove the view from the // save the view on the shared user