users: add unset route for avatar

also add missing tests for avatar and profile locking
This commit is contained in:
Girish Ramakrishnan
2025-07-15 10:06:26 +02:00
parent be9adb64bb
commit 622aecfd6d
9 changed files with 122 additions and 3 deletions
+10
View File
@@ -8,6 +8,7 @@ exports = module.exports = {
setFallbackEmail,
getAvatarById,
setAvatar,
unsetAvatar,
setLanguage,
getBackgroundImage,
setBackgroundImage,
@@ -126,6 +127,15 @@ async function setAvatar(req, res, next) {
next(new HttpSuccess(204, {}));
}
async function unsetAvatar(req, res, next) {
assert.strictEqual(typeof req.user, 'object');
const [error] = await safe(users.setAvatar(req.user, null));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(204, {}));
}
async function getAvatarById(req, res, next) {
assert.strictEqual(typeof req.params, 'object');