Support for sharing stories on Facebook Is there a way to write this code block cleaner and more readable?

 var shareNavigate = function () {
     scope.sharingActions.shareOnFacebook().done(function () {
             app.router.navigateToStories();
         });
 },
     sharePublishNavigate = function () {
         scope.sharingActions.shareOnFacebook().done(function () {
                 scope.model.publish().done(function () {
                         app.router.navigateToStories();
                     });
             });
     },
     loginSharePublishNavigate = function () {
         facebookActions.login().done(function () {
                 sharePublishNavigate();
             });
     };
 if (!noViews &amp;&amp; hasEditPermissions) {
     shareNavigate();
 } else if (noViews) {
     if (hasEditPermissions) {
         sharePublishNavigate();
     } else if (!isLoggeedIn) {
         loginSharePublishNavigate();
     } else {
         shareNavigate();
     }
 }


First I define functions and then in each case I call the relevant function. I am using jQuery deferreds and since I need operation to done, I have many nested methods. Is there any way to beautify this code?
I'd prefer to rewrite this

 if (!noViews &amp;&amp; hasEditPermissions) {
     shareNavigate();
 } else if (noViews) {
     if (hasEditPermissions) {
         sharePublishNavigate();
     } else if (!isLoggeedIn) {
         loginSharePublishNavigate();
     } else {
         shareNavigate();
     }
 }


To this:

 if (hasEditPermissions) {
     if (noViews) {
         sharePublishNavigate();
     } else {
         shareNavigate();
     }
 } else {
     if(loggeedIn) {
         shareNavigate();
     } else {
         loginSharePublishNavigate();
     }
 }


The !noViews is redundant and it is usually confusing if you start an if-else expression with a negation. Besides that, try avoiding else if in favor of nested expressions. You should also try to make the boolean expressions functionally independent - if you have checked noViews somewhere, don't check it again.

I am not sure if the truth table for the two blocks are identical. I'll leave that up to you to verify.