Skip to content

Commit

Permalink
bugfix change value
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeaux committed Dec 8, 2021
1 parent c17bd53 commit b804a68
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/backend/internalApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,6 @@ exports.react = async(req, res, next) => {
/** POST EDIT UPLOAD **/
exports.editUpload = async(req, res, next) => {

// console.log(req.body);
//
// return res.send('hello');

try {

if(!req.user && req.body.uploadToken){
Expand Down Expand Up @@ -656,7 +652,11 @@ exports.editUpload = async(req, res, next) => {
// had to do this check for if the body has a visibility, if it's pending it will brick
// TODO: should be changed such that pending is pendingApproval and not a visibility
// only allow user to change visibility if they have plus, or if it's an admin or moderator
if((upload.uploader.plan === 'plus' || isModeratorOrAdmin) && req.body.visibilty){

const isPlusOrModeratorOrAdmin = upload.uploader.plan === 'plus' || isModeratorOrAdmin;
const visibilityValue = req.body.visibility;

if(isPlusOrModeratorOrAdmin && visibilityValue){
upload.visibility = req.body.visibility;
}
upload.rating = req.body.rating;
Expand Down

0 comments on commit b804a68

Please sign in to comment.