Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add sign out button to settings profile section #12666

Merged
merged 11 commits into from
Jul 29, 2024
Merged

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Jun 20, 2024

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

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

@dbkr dbkr added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Jun 20, 2024
Base automatically changed from dbkr/move_account_management_button_2 to develop July 4, 2024 10:03
dbkr added 3 commits July 4, 2024 11:45
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.
src/Modal.tsx Outdated Show resolved Hide resolved
Copy link
Member

@richvdh richvdh left a 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
Comment on lines 118 to 129
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();
}
};
Copy link
Member

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.

Copy link
Member Author

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...
Copy link
Member

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?

Copy link
Member Author

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">
Copy link
Member

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?

Copy link
Member Author

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.

dbkr added a commit that referenced this pull request Jul 15, 2024
@dbkr dbkr mentioned this pull request Jul 15, 2024
4 tasks
github-merge-queue bot pushed a commit that referenced this pull request Jul 23, 2024
* Close any open modals on logout

Split out from #12666

* Add test
@dbkr
Copy link
Member Author

dbkr commented Jul 23, 2024

Split out PR also has a test :)

@dbkr dbkr added this pull request to the merge queue Jul 29, 2024
Merged via the queue into develop with commit c2c1089 Jul 29, 2024
29 checks passed
@dbkr dbkr deleted the dbkr/sign_out_button branch July 29, 2024 13:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants