fixed global visibility query

This commit is contained in:
hpcwoess 2020-08-28 17:56:57 +02:00
parent 1ab316c774
commit dbfe62df6a
2 changed files with 2 additions and 1 deletions

View file

@ -180,6 +180,7 @@ router.get('/', auth.optional, function(req, res, next) {
.skip(Number(offset))
.sort({createdAt: 'desc'})
.populate('author')
.where('visibleForAll || author == user')
.exec(),
Track.countDocuments(query).exec(),
req.payload ? User.findById(req.payload.id) : null,

View file

@ -32,7 +32,7 @@ router.put('/user', auth.required, function(req, res, next){
if(typeof req.body.user.areTracksVisibleForAll !== 'undefined'){
user.areTracksVisibleForAll = req.body.user.areTracksVisibleForAll;
}
if(typeof req.body.user.password !== 'undefined'){
if(typeof req.body.user.password !== 'undefined' && req.body.user.password !='' ){
user.setPassword(req.body.user.password);
}