Release 28 June 2021 #387

Merged
Irev-Dev merged 12 commits from main into release 2021-06-28 12:51:55 +02:00
2 changed files with 8 additions and 3 deletions
Showing only changes of commit e91a264768 - Show all commits

View File

@@ -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 })
}

View File

@@ -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)