fix(pet): each user's pet tells only of their own sessions
An admin/analyst's pet counted every user's sessions (live, waiting, errors) because their WebSocket carries everyone's. Server mode now marks their session/agent/event frames `mine: true|false` (scope.broadcastAudience owners, worked out once per broadcast), and GET /api/sessions?mine=1 lists only the caller's own sessions (ownSessionWhere). The pet seeds from mine=1 and skips frames marked mine: false. Developers and local mode are unchanged.
This commit is contained in:
@@ -160,6 +160,13 @@ router.get("/", (req, res) => {
|
||||
);
|
||||
params.push(Number(lane), Number(lane));
|
||||
}
|
||||
// `mine=1` = the requesting user's OWN sessions whatever their role (the
|
||||
// pet's count): an admin/analyst otherwise sees every user's. "1" locally.
|
||||
if (req.query.mine === "1") {
|
||||
const o = require("../lib/scope").ownSessionWhere(req, "s.id", "s.lane_id");
|
||||
where.push(o.where);
|
||||
params.push(...o.params);
|
||||
}
|
||||
// `awaiting=1` = only sessions blocked on the user (an active session with
|
||||
// `awaiting_input_since`), the UI's "Waiting" filter, done before the limit.
|
||||
if (req.query.awaiting === "1") {
|
||||
|
||||
Reference in New Issue
Block a user