(core) Revert part of the recent tweaks to AppHeader

Summary:
In non-SaaS Grist, the AppHeader will no longer link to templates
page. Also, the last visited site is now reset when switching accounts.

Test Plan: Existing tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4048
This commit is contained in:
George Gevoian
2023-09-19 01:31:22 -04:00
parent 927e92e3e8
commit d1826987bb
5 changed files with 16 additions and 8 deletions

View File

@@ -128,6 +128,7 @@ export interface AppModel {
isOwnerOrEditor(): boolean; // If user is an owner or editor of this org
/** Creates an computed observable to dismiss a popup or check if it was dismissed */
dismissedPopup(name: DismissedPopup): Observable<boolean>;
switchUser(user: FullUser, org?: string): Promise<void>;
}
export class TopAppModelImpl extends Disposable implements TopAppModel {
@@ -402,6 +403,11 @@ export class AppModelImpl extends Disposable implements AppModel {
return computed;
}
public async switchUser(user: FullUser, org?: string) {
await this.api.setSessionActive(user.email, org);
this.lastVisitedOrgDomain.set(null);
}
private _updateLastVisitedOrgDomain({doc, org}: IGristUrlState, availableOrgs: Organization[]) {
if (
!org ||