mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix library items count for users with item restricting permissions #4163
This commit is contained in:
		
							parent
							
								
									d3fe52692b
								
							
						
					
					
						commit
						7013600697
					
				@ -601,7 +601,7 @@ module.exports = {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const findAndCountAll = process.env.QUERY_PROFILING ? profile(this.findAndCountAll) : this.findAndCountAll
 | 
					    const findAndCountAll = process.env.QUERY_PROFILING ? profile(this.findAndCountAll) : this.findAndCountAll
 | 
				
			||||||
    const { rows: books, count } = await findAndCountAll(findOptions, limit, offset, !filterGroup)
 | 
					    const { rows: books, count } = await findAndCountAll(findOptions, limit, offset, !filterGroup && !userPermissionBookWhere.bookWhere.length)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const libraryItems = books.map((bookExpanded) => {
 | 
					    const libraryItems = books.map((bookExpanded) => {
 | 
				
			||||||
      const libraryItem = bookExpanded.libraryItem
 | 
					      const libraryItem = bookExpanded.libraryItem
 | 
				
			||||||
 | 
				
			|||||||
@ -204,7 +204,7 @@ module.exports = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const findAndCountAll = process.env.QUERY_PROFILING ? profile(this.findAndCountAll) : this.findAndCountAll
 | 
					    const findAndCountAll = process.env.QUERY_PROFILING ? profile(this.findAndCountAll) : this.findAndCountAll
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const { rows: podcasts, count } = await findAndCountAll(findOptions, Database.podcastModel, limit, offset, !filterGroup)
 | 
					    const { rows: podcasts, count } = await findAndCountAll(findOptions, Database.podcastModel, limit, offset, !filterGroup && !userPermissionPodcastWhere.podcastWhere.length)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const libraryItems = podcasts.map((podcastExpanded) => {
 | 
					    const libraryItems = podcasts.map((podcastExpanded) => {
 | 
				
			||||||
      const libraryItem = podcastExpanded.libraryItem
 | 
					      const libraryItem = podcastExpanded.libraryItem
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user