mirror of
https://github.com/docmost/docmost.git
synced 2026-08-24 09:12:13 +10:00
fix(integrations): don't wipe workspace bot row on per-user disconnect
This commit is contained in:
@@ -169,10 +169,17 @@ export class IntegrationConnectionRepo {
|
|||||||
trx?: KyselyTransaction,
|
trx?: KyselyTransaction,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const db = dbOrTx(this.db, trx);
|
const db = dbOrTx(this.db, trx);
|
||||||
|
// Never delete a kind='workspace' row from a per-user disconnect.
|
||||||
|
// For Slack (and any future workspace-scoped provider) the installer's
|
||||||
|
// userId matches the workspace connection's userId; without this filter
|
||||||
|
// a single user clicking Disconnect would wipe the shared bot token and
|
||||||
|
// break the integration for the whole workspace. Full uninstall uses
|
||||||
|
// deleteByIntegration which intentionally has no kind filter.
|
||||||
await db
|
await db
|
||||||
.deleteFrom('integrationConnections')
|
.deleteFrom('integrationConnections')
|
||||||
.where('integrationId', '=', integrationId)
|
.where('integrationId', '=', integrationId)
|
||||||
.where('userId', '=', userId)
|
.where('userId', '=', userId)
|
||||||
|
.where('kind', '!=', 'workspace')
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user