Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(desktop): reconcile enterprise login with shared spaces

Gabriel Stein9c48b6ba3663
diff --git a/src/hooks/useAuth.ts b/src/hooks/useAuth.ts
index e9763d0ea..966cef0cb 100644
--- a/src/hooks/useAuth.ts
+++ b/src/hooks/useAuth.ts
@@ -59,7 +59,12 @@ async function loadAccountDependencies() {
}
async function refreshManagedEnterpriseIdentity(accountId: string, authGeneration: number) {
- const { refreshManagedEnterpriseIdentity: refresh } = await import("../stores/workspaceStore");
+ const { refreshManagedEnterpriseIdentity: refresh, useWorkspaceStore } =
+ await import("../stores/workspaceStore");
+ // A newly authenticated employee has no active workspace cached yet. Load
+ // memberships first so a single SCIM-provisioned Enterprise workspace is
+ // selected and its managed provider config resolves without opening Settings.
+ await useWorkspaceStore.getState().refresh();
refresh(accountId, authGeneration);
}
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index d7f244b4a..3db8b1dbb 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -3439,6 +3439,7 @@
"description": "これらのワークスペースに、あなたと同じメールドメインのメンバーがいます。",
"invitedDescription": "ワークスペースに招待されています。",
"invitedBy": "{{inviter}} が {{role}} として招待しました",
+ "memberCount_one": "メンバー {{count}} 人",
"memberCount_other": "メンバー {{count}} 人",
"join": "参加",
"requestErrorTitle": "リクエストを送信できませんでした",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 3b879bff1..dee7e8884 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -3439,6 +3439,7 @@
"description": "这些工作区中有与你相同邮箱域名的成员。",
"invitedDescription": "有人邀请你加入一个工作区。",
"invitedBy": "{{inviter}} 邀请你担任{{role}}",
+ "memberCount_one": "{{count}} 位成员",
"memberCount_other": "{{count}} 位成员",
"join": "加入",
"requestErrorTitle": "无法发送申请",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index e4de9ac18..ec8fce09d 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -3439,6 +3439,7 @@
"description": "這些工作區中有與你相同電子郵件網域的成員。",
"invitedDescription": "有人邀請你加入一個工作區。",
"invitedBy": "{{inviter}} 邀請你擔任{{role}}",
+ "memberCount_one": "{{count}} 位成員",
"memberCount_other": "{{count}} 位成員",
"join": "加入",
"requestErrorTitle": "無法送出申請",
diff --git a/src/services/WorkspacesService.ts b/src/services/WorkspacesService.ts
index 1c7acc330..ead80a012 100644
--- a/src/services/WorkspacesService.ts
+++ b/src/services/WorkspacesService.ts
@@ -92,7 +92,7 @@ async function updateSeats(
return res.data;
}
-/** Workspaces the caller can join: pending invitations plus opted-in domain matches. */
+/** Invitations the caller can accept and company-domain workspaces they can ask to join. */
async function listJoinable(): Promise<JoinableWorkspace[]> {
const res = await cloudGet<DataWrap<JoinableWorkspace[]>>("/api/me/joinable");
return res.data;
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 3bd49ed3d..201b07c21 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -393,9 +393,9 @@ export interface JoinableMember {
/**
* A workspace the signed-in user can act on, from GET /api/me/joinable.
- * `source` is why they can see it, `mode` is what the button does: an
- * invitation or an opted-in domain joins outright, a plain domain match only
- * earns the right to ask an admin.
+ * `source` is why they can see it, `mode` is what the button does: a direct
+ * invitation joins, while a company-domain match only earns the right to ask
+ * an admin. Enterprise SSO and SCIM provision through the SSO callback.
*/
export interface JoinableWorkspace {
source: "invitation" | "domain";
diff --git a/test/helpers/syncServiceNotes.test.js b/test/helpers/syncServiceNotes.test.js
index 32c495e16..017ace49f 100644
--- a/test/helpers/syncServiceNotes.test.js
+++ b/test/helpers/syncServiceNotes.test.js
@@ -457,31 +457,42 @@ test("a mid-pagination failure leaves the pull cursor unstamped", async (t) => {
);
});
-test("canSync gating: sign-in and subscription block every call, backup off blocks personal pushes", async (t) => {
+test("canSync gating: sign-out blocks every call; plan and backup gates protect personal notes", async (t) => {
const ctx = await setup(t);
if (!ctx) return;
const { db, cloud } = ctx;
const note = db.saveNote("Pending note", "body", "personal").note;
- for (const key of ["isSignedIn", "isSubscribed"]) {
- enableSync();
- localStorageStub.removeItem(key);
- const service = new SyncService();
- await service.syncAll(true);
- stopSyncTimers(service);
- assert.equal(cloud.log.length, 0, `sync ran with ${key} unset`);
- assert.equal(localStorageStub.getItem("lastSyncedAt"), null);
- }
+ enableSync();
+ localStorageStub.removeItem("isSignedIn");
+ const signedOutService = new SyncService();
+ await signedOutService.syncAll(true);
+ stopSyncTimers(signedOutService);
+ assert.equal(cloud.log.length, 0, "sync ran while signed out");
+ assert.equal(localStorageStub.getItem("lastSyncedAt"), null);
+
+ // Collaboration is free, so an unsubscribed account still checks shared
+ // notes and team spaces. Private backup remains paid and must not run.
+ enableSync();
+ localStorageStub.removeItem("isSubscribed");
+ const freeService = new SyncService();
+ await freeService.syncAll(true);
+ stopSyncTimers(freeService);
+ assert.ok(cloud.log.length > 0, "a free signed-in account must still sync collaboration");
+ assert.equal(cloud.logFor("/api/notes/batch-create").length, 0);
+ assert.equal(db.getNote(note.id).sync_status, "pending");
// Backup off is not sign-out: team-space membership still syncs, but nothing
// personal may leave the machine.
enableSync();
localStorageStub.removeItem("cloudBackupEnabled");
+ const markBeforeBackupOff = cloud.log.length;
const teamOnlyService = new SyncService();
await teamOnlyService.syncAll(true);
stopSyncTimers(teamOnlyService);
assert.equal(
- cloud.logFor("/api/notes/batch-create").length,
+ cloud.log.slice(markBeforeBackupOff).filter((call) => call.path === "/api/notes/batch-create")
+ .length,
0,
"a personal note must not push while backup is off"
);