Allow users to subscribe to community chat topics
Build and Push Docker Images / build-and-push (push) Successful in 1m28s
Build and Push Docker Images / build-and-push (push) Successful in 1m28s
This commit is contained in:
1 parent
68c7ae67f1
commit
baaae2b850
3 files changed
+41
-3
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user