mirror of
https://github.com/wekan/wekan.git
synced 2026-02-10 18:24:21 +01:00
bugfix: only care active members, also optimize some code
This commit is contained in:
parent
b719968df5
commit
672c21bfe0
9 changed files with 62 additions and 78 deletions
|
|
@ -1,8 +1,7 @@
|
|||
allowIsBoardAdmin = function(userId, board) {
|
||||
const admins = _.pluck(_.where(board.members, {isAdmin: true}), 'userId');
|
||||
return _.contains(admins, userId);
|
||||
return board && board.hasAdmin(userId);
|
||||
};
|
||||
|
||||
allowIsBoardMember = function(userId, board) {
|
||||
return _.contains(_.pluck(board.members, 'userId'), userId);
|
||||
return board && board.hasMember(userId);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Meteor.publish('boards', function() {
|
|||
return Boards.find({
|
||||
archived: false,
|
||||
$or: [
|
||||
{ 'members.userId': this.userId },
|
||||
{ members: { $elemMatch: { userId: this.userId, isActive: true }}},
|
||||
{ _id: { $in: starredBoards } },
|
||||
],
|
||||
}, {
|
||||
|
|
@ -66,7 +66,7 @@ Meteor.publishComposite('board', function(boardId) {
|
|||
// it.
|
||||
$or: [
|
||||
{ permission: 'public' },
|
||||
{ 'members.userId': this.userId },
|
||||
{ members: { $elemMatch: { userId: this.userId, isActive: true }}},
|
||||
],
|
||||
}, { limit: 1 });
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue