From f34099de9c481f02753197f1de338eac2f2ec638 Mon Sep 17 00:00:00 2001 From: jerl Date: Tue, 4 Jun 2024 12:00:13 -0700 Subject: [PATCH] displayname fix --- src/events/user.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/events/user.js b/src/events/user.js index 6c041cc..101aad5 100644 --- a/src/events/user.js +++ b/src/events/user.js @@ -157,7 +157,15 @@ async function authorize_key(msg, respond) { } async function update_user(msg, respond) { - await db.query(`update user set displayname = ?`, msg.displayname); + if ((await db.query( + `update user set displayname = ? + where name = ? + returning id`, + [msg.displayname, msg.auth_user.name])).rows.length === 0) + return respond({ + success: false, + message: 'user not found' + }); vybe.users[msg.auth_user.name].displayname = msg.displayname; respond({ success: true