fix: a few issues with old node version, again

This commit is contained in:
Paul Bienkowski 2020-11-24 00:32:49 +01:00
parent 3b1376b661
commit cdadbb5df4

View file

@ -335,7 +335,7 @@ router.get(
req.track.populate('author').execPopulate(),
]);
if (!req.track.visible && req.track.author._id.toString() !== req.payload?.id?.toString()) {
if (!req.track.visible && (!req.payload || req.track.author._id.toString() !== req.payload.id.toString())) {
return res.sendStatus(403);
}
@ -365,7 +365,7 @@ router.put(
req.track.description = body.description;
}
if (body && body.trim()) {
if (body.body && body.body.trim()) {
req.track.body = body.body.trim();
let trackData = await TrackData.findById(req.track.trackData);