-
-
Notifications
You must be signed in to change notification settings - Fork 830
Add sign out button to settings profile section #12666
Conversation
ab4d2ae
to
3e30430
Compare
And move the logic for displaying the dialog out of the user menu to somewhere it can be re-used. Also close any open dialog on logout, because otherwise, well... you can guess.
3f258ef
to
5f46ba0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts, nothing major.
I would quite like to see some ✨ tests ✨.
src/Modal.tsx
Outdated
public constructor() { | ||
super(); | ||
|
||
// We never unregister this: it's a singleton. An instance could be instantiated, in theory... | ||
defaultDispatcher.register(this.onAction); | ||
} | ||
|
||
private onAction = (payload: ActionPayload): void => { | ||
if (payload.action === "logout") { | ||
this.forceCloseAllModals(); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels like something that should be in a separate PR, tbh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split out to #12777
src/Modal.tsx
Outdated
public constructor() { | ||
super(); | ||
|
||
// We never unregister this: it's a singleton. An instance could be instantiated, in theory... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An instance could be instantiated, in theory...
Don't quite get this. So we should deregister the listener?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this comment in the split out PR so hopefully its clearer.
@@ -219,11 +243,12 @@ const UserProfileSettings: React.FC<UserProfileSettingsProps> = ({ | |||
</Alert> | |||
)} | |||
{userIdentifier && <UsernameBox username={userIdentifier} />} | |||
{externalAccountManagementUrl && ( | |||
<div className="mx_UserProfileSettings_profile_buttons"> | |||
<Flex gap="var(--cpd-space-4x)" className="mx_UserProfileSettings_profile_buttons"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really want this sort of inline CSS? Shouldn't the gap
be on the CSS class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really have thought so, yeah, but this seems to be how the Flex component is used, and that's what was suggested.
* Close any open modals on logout Split out from #12666 * Add test
Split out PR also has a test :) |
And move the logic for displaying the dialog out of the user menu to somewhere it can be re-used.
Also close any open dialog on logout, because otherwise, well... you can guess.
Checklist
public
/exported
symbols have accurate TSDoc documentation.