From 697a03b38804ceaedc523a8b15d1c347b272e407 Mon Sep 17 00:00:00 2001 From: red binder Date: Sun, 9 Aug 2026 02:01:20 +0200 Subject: [PATCH] let user see their own presence --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index dfdb05a..154f87d 100644 --- a/index.js +++ b/index.js @@ -104,8 +104,10 @@ app.get('/api/v1/presence/:pid', authenticateUser, async (req, res) => { const checkResult = await pool.query(friendshipCheck, [userPid, targetPid]); - if (!checkResult.rows[0].is_friend) { - return res.status(403).json({ code: "0301", error: 'Request denied: target user is not in your friends list' }); + if (targetPid != userPid) { + if (!checkResult.rows[0].is_friend) { + return res.status(403).json({ code: "0301", error: 'Request denied: target user is not in your friends list' }); + } } const presenceQuery = `SELECT presence, updated_at FROM user_presences WHERE pid = $1;`;