let user see their own presence
This commit is contained in:
parent
8cf67487f5
commit
697a03b388
1 changed files with 4 additions and 2 deletions
2
index.js
2
index.js
|
|
@ -104,9 +104,11 @@ 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 (targetPid != userPid) {
|
||||||
if (!checkResult.rows[0].is_friend) {
|
if (!checkResult.rows[0].is_friend) {
|
||||||
return res.status(403).json({ code: "0301", error: 'Request denied: target user is not in your friends list' });
|
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;`;
|
||||||
const presenceResult = await pool.query(presenceQuery, [targetPid]);
|
const presenceResult = await pool.query(presenceQuery, [targetPid]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue