MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / deleteRemoteWorkspaceProfile

Function deleteRemoteWorkspaceProfile

apps/desktop/src/main/index.ts:1665–1693  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

1663}
1664
1665async function deleteRemoteWorkspaceProfile(id: string): Promise<void> {
1666 const deletedSecret = await getRemoteWorkspaceSecret(id)
1667 await updateConfig((cfg) => {
1668 const deletedProfile = findRemoteProfileById(cfg.remoteWorkspaceProfiles, id)
1669 const nextProfiles = cfg.remoteWorkspaceProfiles.filter((entry) => entry.id !== id)
1670 const nextCurrentProfileId =
1671 cfg.remoteWorkspaceProfileId === id ? null : cfg.remoteWorkspaceProfileId
1672 const shouldClearLegacyRemoteWorkspace =
1673 !!deletedProfile &&
1674 !!cfg.remoteWorkspace &&
1675 normalizeRemoteBaseUrl(cfg.remoteWorkspace.baseUrl) ===
1676 normalizeRemoteBaseUrl(deletedProfile.baseUrl) &&
1677 !nextProfiles.some(
1678 (entry) =>
1679 normalizeRemoteBaseUrl(entry.baseUrl) === normalizeRemoteBaseUrl(deletedProfile.baseUrl)
1680 )
1681 currentRemoteWorkspaceProfileId = nextCurrentProfileId
1682 return {
1683 ...cfg,
1684 remoteWorkspace: shouldClearLegacyRemoteWorkspace ? null : cfg.remoteWorkspace,
1685 remoteWorkspaceProfiles: nextProfiles,
1686 remoteWorkspaceProfileId: nextCurrentProfileId
1687 }
1688 })
1689 await deleteRemoteWorkspaceSecret(id)
1690 if (deletedSecret && currentRemoteWorkspaceProfileId === id) {
1691 remoteWorkspaceClient = null
1692 }
1693}
1694
1695async function connectRemoteWorkspaceProfile(
1696 profileId: string

Callers 2

registerIpcFunction · 0.70
SettingsModalFunction · 0.50

Calls 5

getRemoteWorkspaceSecretFunction · 0.90
updateConfigFunction · 0.90
findRemoteProfileByIdFunction · 0.85
normalizeRemoteBaseUrlFunction · 0.85

Tested by

no test coverage detected