fix(requests): correctly filter requests out for users without view requests permission

pull/935/head
sct 4 years ago
parent 50c143d959
commit e118501bf1

@ -89,7 +89,7 @@ requestRoutes.get('/', async (req, res, next) => {
requestStatus: statusFilter,
})
.andWhere(
'(request.is4k = false AND media.status IN (:...mediaStatus)) OR (request.is4k = true AND media.status4k IN (:...mediaStatus))',
'((request.is4k = 0 AND media.status IN (:...mediaStatus)) OR (request.is4k = 1 AND media.status4k IN (:...mediaStatus)))',
{
mediaStatus: mediaStatusFilter,
}
@ -101,7 +101,7 @@ requestRoutes.get('/', async (req, res, next) => {
{ type: 'or' }
)
) {
query = query.andWhere('request.requestedBy.id = :id', {
query = query.andWhere('requestedBy.id = :id', {
id: req.user?.id,
});
}

Loading…
Cancel
Save