Allow users to subscribe to community chat topics
Build and Push Docker Images / build-and-push (push) Successful in 1m28s

This commit is contained in:
Bram committed 2026-10-29 10:49:36 +00:00
1 parent 68c7ae67f1
commit baaae2b850
3 files changed
+41 -3

No files matched your search

+7 -1
View File
@@ -172,7 +172,7 @@ function createBroker(env = process.env) {
return false;
}
return /^(user\/[0-9a-fA-F-]{36}\/notifications|event\/[A-Za-z0-9_-]+\/ticket_statistics)$/.test(topic);
return /^(user\/[0-9a-fA-F-]{36}\/notifications|community\/user\/[0-9a-fA-F-]{36}|event\/[A-Za-z0-9_-]+\/ticket_statistics)$/.test(topic);
}
function normalizeSubscription(payload) {
@@ -205,6 +205,12 @@ function createBroker(env = process.env) {
return userTopic[1] === socket.data.auth.sub;
}
const communityUserTopic = topic.match(/^community\/user\/([^/]+)$/);
if (communityUserTopic) {
return communityUserTopic[1] === socket.data.auth.sub;
}
const verifiedTopicToken = verifyToken(topicToken, 'topic');
if (!verifiedTopicToken) {