diff --git a/src/components/apphost.js b/src/components/apphost.js index 6afe6dc8f37..7fe6c356655 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -304,24 +304,26 @@ function askForExit() { return; } - import('../components/actionSheet/actionSheet').then((actionsheet) => { - exitPromise = actionsheet.show({ - title: globalize.translate('MessageConfirmAppExit'), - items: [ - { id: 'logout', name: globalize.translate('ButtonSignOut') }, - { id: 'yes', name: globalize.translate('Yes') }, - { id: 'no', name: globalize.translate('No') } - ] - }).then(function (value) { - if (value === 'yes') { - doExit(); - } else if (value === 'logout') { - import('../scripts/clientUtils').then((clientUtils) => { + import('../scripts/clientUtils').then(() => { + import('../components/actionSheet/actionSheet').then((actionsheet) => { + const userId = Dashboard.getCurrentUserId(); + const logoutEntry = userId ? [{ id: 'logout', name: globalize.translate('ButtonSignOut') }] : []; + exitPromise = actionsheet.show({ + title: globalize.translate('MessageConfirmAppExit'), + items: [ + ...logoutEntry, + { id: 'yes', name: globalize.translate('Yes') }, + { id: 'no', name: globalize.translate('No') } + ] + }).then(function (value) { + if (value === 'yes') { + doExit(); + } else if (value === 'logout') { Dashboard.logout(); - }); - } - }).finally(function () { - exitPromise = null; + } + }).finally(function () { + exitPromise = null; + }); }); }); }