Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3370929
D12223.id41028.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12223.id41028.diff
View Options
diff --git a/web/settings/account-settings.react.js b/web/settings/account-settings.react.js
--- a/web/settings/account-settings.react.js
+++ b/web/settings/account-settings.react.js
@@ -2,7 +2,11 @@
import * as React from 'react';
-import { useLogOut, logOutActionTypes } from 'lib/actions/user-actions.js';
+import {
+ useLogOut,
+ logOutActionTypes,
+ useSecondaryDeviceLogOut,
+} from 'lib/actions/user-actions.js';
import { useModalContext } from 'lib/components/modal-provider.react.js';
import SWMansionIcon from 'lib/components/swmansion-icon.react.js';
import { useStringForUser } from 'lib/hooks/ens-cache.js';
@@ -14,6 +18,7 @@
createOlmSessionsWithOwnDevices,
getContentSigningKey,
} from 'lib/utils/crypto-utils.js';
+import { isDev } from 'lib/utils/dev-utils.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
import css from './account-settings.css';
@@ -31,11 +36,20 @@
function AccountSettings(): React.Node {
const sendLogoutRequest = useLogOut();
+ const sendSecondaryDeviceLogoutRequest = useSecondaryDeviceLogOut();
const dispatchActionPromise = useDispatchActionPromise();
const logOutUser = React.useCallback(
() => dispatchActionPromise(logOutActionTypes, sendLogoutRequest()),
[dispatchActionPromise, sendLogoutRequest],
);
+ const logOutSecondaryDevice = React.useCallback(
+ () =>
+ dispatchActionPromise(
+ logOutActionTypes,
+ sendSecondaryDeviceLogoutRequest(),
+ ),
+ [dispatchActionPromise, sendSecondaryDeviceLogoutRequest],
+ );
const identityContext = React.useContext(IdentityClientContext);
const userID = useSelector(state => state.currentUserInfo?.id);
@@ -141,6 +155,18 @@
);
}
+ let experimentalLogOutSection;
+ if (isDev) {
+ experimentalLogOutSection = (
+ <li>
+ <span>Log out secondary device</span>
+ <Button variant="text" onClick={logOutSecondaryDevice}>
+ <p className={css.buttonText}>Log out</p>
+ </Button>
+ </li>
+ );
+ }
+
let preferences;
if (staffCanSee) {
preferences = (
@@ -257,6 +283,7 @@
<p className={css.buttonText}>Log out</p>
</Button>
</li>
+ {experimentalLogOutSection}
{changePasswordSection}
<li>
<span>Friend List</span>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 4:12 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2586290
Default Alt Text
D12223.id41028.diff (2 KB)
Attached To
Mode
D12223: [web] Add dev-only button to log out secondary device
Attached
Detach File
Event Timeline
Log In to Comment