fix(dashboard): add organizationId to the webhook url

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-10-03 09:33:18 +02:00
parent 761b64d248
commit ea27ca1e0a
2 changed files with 11 additions and 5 deletions

View File

@@ -235,12 +235,21 @@ export async function wsIntegrationsSlack(
};
}>,
) {
const { organizationId } = req.query;
if (!organizationId) {
connection.socket.send('No organizationId provided');
connection.socket.close();
return;
}
const subscribeToEvent = 'integrations:slack';
getRedisSub().subscribe(subscribeToEvent);
const onMessage = (channel: string, message: string) => {
if (channel === subscribeToEvent) {
const parsed = getSuperJson<{ organizationId: string }>(message);
if (parsed && parsed.organizationId === req.query.organizationId) {
if (parsed && parsed.organizationId === organizationId) {
connection.socket.send(message);
}
}