fix(server): key connected-account lookup on handle and provider (#22964)
Connect flows (Google, Microsoft, IMAP/SMTP/CalDAV) looked up an existing connectedAccount by `handle` alone, so connecting a second account with the same handle but a different provider overwrote the first instead of inserting a new row (e.g. IMAP inbox clobbering a calendar-only Google account). Fix: add the `provider` discriminator to the lookup. Same provider+handle still updates; a different provider gets its own row. Integration test covers the Google-then-IMAP case.
This commit is contained in:
@@ -154,6 +154,7 @@ export class GoogleAPIsService {
|
||||
handle,
|
||||
userWorkspaceId,
|
||||
workspaceId,
|
||||
provider: ConnectedAccountProvider.GOOGLE,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ export class MicrosoftAPIsService {
|
||||
handle,
|
||||
userWorkspaceId: userWorkspaceId,
|
||||
workspaceId,
|
||||
provider: ConnectedAccountProvider.MICROSOFT,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user