From 938d344bd0554dfdbf03ff26727d976b8d59e368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5var=20Aamb=C3=B8=20Fosstveit?= Date: Sun, 5 Apr 2020 21:47:44 +0200 Subject: [PATCH] Login status not reflected in login button, fixes #173 --- app/src/RoomClient.js | 2 ++ app/src/components/JoinDialog.js | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/src/RoomClient.js b/app/src/RoomClient.js index 87ac171..6797c28 100644 --- a/app/src/RoomClient.js +++ b/app/src/RoomClient.js @@ -503,6 +503,8 @@ export default class RoomClient { logger.debug('receiveLogoutChildWindow()'); + store.dispatch(meActions.setPicture(null)); + store.dispatch(meActions.loggedIn(false)); store.dispatch(requestActions.notify( diff --git a/app/src/components/JoinDialog.js b/app/src/components/JoinDialog.js index 814a18d..85262b1 100644 --- a/app/src/components/JoinDialog.js +++ b/app/src/components/JoinDialog.js @@ -103,7 +103,7 @@ const DialogTitle = withStyles(styles)((props) => }; }, []); - const { children, classes, myPicture, onLogin, ...other } = props; + const { children, classes, myPicture, onLogin, loggedIn, ...other } = props; const handleTooltipClose = () => { @@ -115,6 +115,17 @@ const DialogTitle = withStyles(styles)((props) => setOpen(true); }; + const loginTooltip = loggedIn ? + intl.formatMessage({ + id : 'tooltip.logout', + defaultMessage : 'Log out' + }) + : + intl.formatMessage({ + id : 'tooltip.login', + defaultMessage : 'Log in' + }); + return ( { window.config && window.config.logo && Logo } @@ -124,10 +135,7 @@ const DialogTitle = withStyles(styles)((props) => onClose={handleTooltipClose} onOpen={handleTooltipOpen} open={open} - title={intl.formatMessage({ - id : 'tooltip.login', - defaultMessage : 'Click to log in' - })} + title={loginTooltip} placement='left' > + onLogin={() => { loggedIn ? roomClient.logout() : roomClient.login(); }} + loggedIn={loggedIn} > { window.config && window.config.title ? window.config.title : 'Multiparty meeting' }