File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -54,13 +54,30 @@ module.exports = {
5454 userIdsInSameBoards = sameBoardMemberships . map ( ( bm ) => bm . userId ) ;
5555 }
5656
57- // Find all users in the same projects
57+ // Find all users in the same projects (both managers and board members)
5858 let userIdsInSameProjects = [ ] ;
5959 if ( currentUserProjectIds . length > 0 ) {
6060 const sameProjectManagements = await ProjectManager . find ( {
6161 projectId : currentUserProjectIds ,
6262 } ) ;
63- userIdsInSameProjects = sameProjectManagements . map ( ( pm ) => pm . userId ) ;
63+
64+ const boardsInProjects = await Board . find ( {
65+ projectId : currentUserProjectIds ,
66+ } ) . select ( [ 'id' ] ) ;
67+ const boardIdsInProjects = boardsInProjects . map ( ( b ) => b . id ) ;
68+
69+ let userIdsInProjectBoards = [ ] ;
70+ if ( boardIdsInProjects . length > 0 ) {
71+ const projectBoardMemberships = await BoardMembership . find ( {
72+ boardId : boardIdsInProjects ,
73+ } ) ;
74+ userIdsInProjectBoards = projectBoardMemberships . map ( ( bm ) => bm . userId ) ;
75+ }
76+
77+ userIdsInSameProjects = [
78+ ...sameProjectManagements . map ( ( pm ) => pm . userId ) ,
79+ ...userIdsInProjectBoards ,
80+ ] ;
6481 }
6582
6683 // Combine all user IDs from shared contexts (excluding needed ones)
You canāt perform that action at this time.
0 commit comments