Adapt OAuth2 implementation to Matrix Spec v1.18 (#34026)

* Adapt OAuth2 implementation to Matrix Spec v1.18

* Handle more cases of oidc->oauth

* Fix test

* Fix read back of oauth2 context

* Iterate

* Fix tests

* Discard changes to apps/web/playwright/e2e/settings/account-user-settings-tab.spec.ts

* Fix test

* Fix test

* Fix test

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Iterate

* Iterate

* Fix test

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This commit is contained in:
Michael Telatynski
2026-07-08 09:02:25 +01:00
committed by GitHub
parent 38e29c51c4
commit 2bc9656957
69 changed files with 761 additions and 1738 deletions
@@ -39,7 +39,6 @@ export class UserMenuViewModel
client: MatrixClient,
ownProfileStore: OwnProfileStore,
isPanelCollapsed: boolean,
accountManagementEndpoint?: string,
): UserMenuSnapshot {
const hasHomePage = !!getHomePageUrl(SdkConfig.get(), client);
const isAuthenticated = !client.isGuest();
@@ -58,7 +57,7 @@ export class UserMenuViewModel
displayName,
avatarUrl,
expanded: !isPanelCollapsed,
manageAccountHref: accountManagementEndpoint,
manageAccountHref: undefined, // loaded async
showAvatar: isAuthenticated,
userStatus: ownProfileStore.userStatus,
showUserStatus: SettingsStore.getValue("feature_user_status") && isAuthenticated,
@@ -80,19 +79,11 @@ export class UserMenuViewModel
private readonly dispatcher: MatrixDispatcher,
private readonly client: MatrixClient,
isPanelCollapsed: boolean,
accountManagementEndpoint?: string,
) {
super(
props,
UserMenuViewModel.computeSnapshot(
client,
props.ownProfileStore,
isPanelCollapsed,
accountManagementEndpoint,
),
);
super(props, UserMenuViewModel.computeSnapshot(client, props.ownProfileStore, isPanelCollapsed));
this.setStatusVm = new UserMenuSetStatusViewModel({ client, ownProfileStore: props.ownProfileStore });
props.ownProfileStore.on(UPDATE_EVENT, this.recalculateProfile);
this.loadAuthMetadata();
}
public dispose(): void {
@@ -166,4 +157,9 @@ export class UserMenuViewModel
logger.warn("Failed to clear user status", err);
});
};
private async loadAuthMetadata(): Promise<void> {
const authMetadata = await this.client.getAuthMetadata().catch(() => {});
this.snapshot.merge({ manageAccountHref: authMetadata?.account_management_uri });
}
}