diff --git a/app/api/src/services/parts/parts.js b/app/api/src/services/parts/parts.js index 87a8d6e..e636055 100644 --- a/app/api/src/services/parts/parts.js +++ b/app/api/src/services/parts/parts.js @@ -77,13 +77,17 @@ export const updatePart = async ({ id, input }) => { } const originalPart = await db.part.findUnique({ where: { id } }) const imageToDestroy = - originalPart.mainImage !== input.mainImage && input.mainImage && originalPart.mainImage + originalPart.mainImage !== input.mainImage && + input.mainImage && + originalPart.mainImage const update = await db.part.update({ data: foreignKeyReplacement(input), where: { id }, }) if (imageToDestroy) { - console.log(`image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`) + console.log( + `image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}` + ) // destroy after the db has been updated destroyImage({ publicId: imageToDestroy }) } diff --git a/app/web/src/components/PartProfile/PartProfile.js b/app/web/src/components/PartProfile/PartProfile.js index 4159333..1a4602b 100644 --- a/app/web/src/components/PartProfile/PartProfile.js +++ b/app/web/src/components/PartProfile/PartProfile.js @@ -27,7 +27,8 @@ const PartProfile = ({ const [isInvalid, setIsInvalid] = useState(false) const { currentUser } = useAuth() const editorRef = useRef(null) - const canEdit = currentUser?.sub === userPart.id || currentUser?.roles.includes('admin') + const canEdit = + currentUser?.sub === userPart.id || currentUser?.roles.includes('admin') const isImageEditable = !isEditable && canEdit // image is editable when not in profile edit mode in order to separate them as it's too hard too to upload an image to cloudinary temporarily until the use saves (and maybe have to clean up) for the time being const part = userPart?.Part const emotes = countEmotes(part?.Reaction)