make default avatar use the avatars table

This commit is contained in:
2025-05-22 02:30:59 +03:00
parent 16127983ab
commit 9438d3704b
8 changed files with 47 additions and 7 deletions

View File

@ -150,8 +150,10 @@ app:post("user_clear_avatar", "/:username/clear_avatar", function(self)
if me.id ~= target_user.id then
return {redirect_to = self:url_for("user", {username = self.params.username})}
end
local old_avatar_id = target_user.avatar_id
util.destroy_avatar(old_avatar_id)
target_user:update({
avatar_id = db.NULL,
avatar_id = 1,
})
util.inject_infobox(self, "Avatar cleared.")
return {redirect_to = self:url_for("user_settings", {username = self.params.username})}