fixed global visibility query
This commit is contained in:
parent
1ab316c774
commit
dbfe62df6a
|
@ -180,6 +180,7 @@ router.get('/', auth.optional, function(req, res, next) {
|
||||||
.skip(Number(offset))
|
.skip(Number(offset))
|
||||||
.sort({createdAt: 'desc'})
|
.sort({createdAt: 'desc'})
|
||||||
.populate('author')
|
.populate('author')
|
||||||
|
.where('visibleForAll || author == user')
|
||||||
.exec(),
|
.exec(),
|
||||||
Track.countDocuments(query).exec(),
|
Track.countDocuments(query).exec(),
|
||||||
req.payload ? User.findById(req.payload.id) : null,
|
req.payload ? User.findById(req.payload.id) : null,
|
||||||
|
|
|
@ -32,7 +32,7 @@ router.put('/user', auth.required, function(req, res, next){
|
||||||
if(typeof req.body.user.areTracksVisibleForAll !== 'undefined'){
|
if(typeof req.body.user.areTracksVisibleForAll !== 'undefined'){
|
||||||
user.areTracksVisibleForAll = req.body.user.areTracksVisibleForAll;
|
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);
|
user.setPassword(req.body.user.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue