add delete_at when user is deactivated

This commit is contained in:
2026-05-18 17:08:12 +03:00
parent 14684e0901
commit 0369a40ad9
2 changed files with 5 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ const schema = {
notify_props: Joi.object({ notify_props: Joi.object({
mention_keys: Joi.string().optional().allow(''), mention_keys: Joi.string().optional().allow(''),
}).optional(), }).optional(),
delete_at: Joi.number().integer().min(0).optional(),
} }
// //

View File

@@ -59,6 +59,10 @@ module.exports = async function(context) {
if (!user.roles.length) { if (!user.roles.length) {
delete user.roles delete user.roles
} }
if (result.active === false) {
user.delete_at = result._updatedAt ? new Date(result._updatedAt).getTime() : Date.now()
}
const avatar = await getAvatar(context, result) const avatar = await getAvatar(context, result)
if (avatar) { if (avatar) {
user.profile_image = avatar user.profile_image = avatar