fixed logout

This commit is contained in:
Elyor Djalilov 2024-07-04 11:14:23 +05:00
parent 7883f3152d
commit 0e9d0e9dc9
3 changed files with 14 additions and 3 deletions

View File

@ -47,6 +47,7 @@ const LogoutAllSessionDialog = ({
onLogoutAllUsers, onLogoutAllUsers,
onLogoutAllSessions, onLogoutAllSessions,
onLogoutAllExceptThis, onLogoutAllExceptThis,
setUserSessionPanelVisible,
}) => { }) => {
const [isChecked, setIsChecked] = useState(false); const [isChecked, setIsChecked] = useState(false);
@ -60,7 +61,7 @@ const LogoutAllSessionDialog = ({
if (!isChecked) { if (!isChecked) {
isSeveralSelection isSeveralSelection
? onLogoutAllUsers(t, userIds) ? onLogoutAllUsers(t, userIds)
: onLogoutAllSessions(t); : onLogoutAllSessions(t).then(() => setUserSessionPanelVisible(false));
onClose(); onClose();
} else { } else {
onLogoutAllExceptThis(t, exceptId, displayName); onLogoutAllExceptThis(t, exceptId, displayName);

View File

@ -99,6 +99,7 @@ const Sessions = ({
updateUserStatus, updateUserStatus,
getLoginHistoryReport, getLoginHistoryReport,
isLoadingDownloadReport, isLoadingDownloadReport,
setUserSessionPanelVisible,
isSessionsLoaded, isSessionsLoaded,
}) => { }) => {
const { t } = useTranslation([ const { t } = useTranslation([
@ -197,15 +198,17 @@ const Sessions = ({
onLogoutAllUsers={onClickLogoutAllUsers} onLogoutAllUsers={onClickLogoutAllUsers}
onLogoutAllSessions={onClickLogoutAllSessions} onLogoutAllSessions={onClickLogoutAllSessions}
onLogoutAllExceptThis={onClickLogoutAllExceptThis} onLogoutAllExceptThis={onClickLogoutAllExceptThis}
setUserSessionPanelVisible={setUserSessionPanelVisible}
/> />
)} )}
</MainContainer> </MainContainer>
); );
}; };
export default inject(({ settingsStore, setup, peopleStore }) => { export default inject(({ settingsStore, setup, peopleStore, dialogsStore }) => {
const { updateUserStatus } = peopleStore.usersStore; const { updateUserStatus } = peopleStore.usersStore;
const { currentDeviceType } = settingsStore; const { currentDeviceType } = settingsStore;
const { setUserSessionPanelVisible } = dialogsStore;
const { const {
allSessions, allSessions,
displayName, displayName,
@ -259,6 +262,7 @@ export default inject(({ settingsStore, setup, peopleStore }) => {
updateUserStatus, updateUserStatus,
getLoginHistoryReport, getLoginHistoryReport,
isLoadingDownloadReport, isLoadingDownloadReport,
setUserSessionPanelVisible,
isSessionsLoaded: allSessions.length > 0, isSessionsLoaded: allSessions.length > 0,
}; };
})(observer(Sessions)); })(observer(Sessions));

View File

@ -646,7 +646,13 @@ class SelectionStore {
return { ...data, ...session, connections }; return { ...data, ...session, connections };
}); });
return sessions.filter((session) => session.connections.length !== 0); const filteredSessions = sessions.filter(
(item) =>
item.connections.length !== 0 &&
item.sessions.some((session) => session.hasOwnProperty("id")),
);
return filteredSessions;
} }
fetchData = async () => { fetchData = async () => {