From f05abfcb9ade388afeb852e267296001ccbdedcb Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 20 Feb 2018 14:16:58 -0500 Subject: [PATCH] fix for #552 --- server/controllers/project.controller.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server/controllers/project.controller.js b/server/controllers/project.controller.js index 3c01ded2..7f276d48 100644 --- a/server/controllers/project.controller.js +++ b/server/controllers/project.controller.js @@ -222,9 +222,19 @@ export function projectForUserExists(username, projectId, callback) { callback(false); return; } - Project.findById(projectId, (innerErr, project) => ( - (project && project.user.equals(user._id)) ? callback(true) : callback(false) - )); + Project.findOne({_id: projectId, user: user._id}, (innerErr, project) => { + if (project) { + callback(true); + return; + } + Project.findOne({slug: projectId, user: user._id}, (slugError, projectBySlug) => { + if (projectBySlug) { + callback(true); + return; + } + callback(false); + }); + }); }); }