let user see their own presence

This commit is contained in:
red binder 2026-08-09 02:01:20 +02:00
commit 697a03b388

View file

@ -104,8 +104,10 @@ app.get('/api/v1/presence/:pid', authenticateUser, async (req, res) => {
const checkResult = await pool.query(friendshipCheck, [userPid, targetPid]); const checkResult = await pool.query(friendshipCheck, [userPid, targetPid]);
if (!checkResult.rows[0].is_friend) { if (targetPid != userPid) {
return res.status(403).json({ code: "0301", error: 'Request denied: target user is not in your friends list' }); 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;`; const presenceQuery = `SELECT presence, updated_at FROM user_presences WHERE pid = $1;`;