mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
fix: Subscribe only when needed
This commit is contained in:
parent
b955e933b2
commit
58eda7d555
10 changed files with 28 additions and 23 deletions
|
@ -108,10 +108,6 @@ module.exports = {
|
|||
request: this.req,
|
||||
});
|
||||
|
||||
if (this.req.isSocket) {
|
||||
sails.sockets.join(this.req, `board:${board.id}`); // TODO: only when subscription needed
|
||||
}
|
||||
|
||||
return {
|
||||
item: board,
|
||||
included: {
|
||||
|
|
|
@ -11,6 +11,9 @@ module.exports = {
|
|||
regex: /^[0-9]+$/,
|
||||
required: true,
|
||||
},
|
||||
subscribe: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
|
@ -73,8 +76,8 @@ module.exports = {
|
|||
card.isSubscribed = isSubscribedByCardId[card.id] || false;
|
||||
});
|
||||
|
||||
if (this.req.isSocket) {
|
||||
sails.sockets.join(this.req, `board:${board.id}`); // TODO: only when subscription needed
|
||||
if (inputs.subscribe && this.req.isSocket) {
|
||||
sails.sockets.join(this.req, `board:${board.id}`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -13,6 +13,9 @@ module.exports = {
|
|||
regex: /^[0-9]+|me$/,
|
||||
required: true,
|
||||
},
|
||||
subscribe: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
|
@ -26,8 +29,8 @@ module.exports = {
|
|||
if (inputs.id === CURRENT_USER_ID) {
|
||||
({ currentUser: user } = this.req);
|
||||
|
||||
if (this.req.isSocket) {
|
||||
sails.sockets.join(this.req, `user:${user.id}`); // TODO: only when subscription needed
|
||||
if (inputs.subscribe && this.req.isSocket) {
|
||||
sails.sockets.join(this.req, `user:${user.id}`);
|
||||
}
|
||||
} else {
|
||||
user = await sails.helpers.users.getOne(inputs.id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue