diff --git a/backend/app/main.py b/backend/app/main.py index 4bc8ee7..0ae5d7d 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -634,15 +634,15 @@ def set_member_mod(lid: str, username: str, body: dict = Body(...), user: dict = def _recipient(con, lobby, user: dict, to): - """User id to whisper to (the DM or a member, not yourself), None for everybody.""" + """User id to whisper to (the DM, a member or yourself for private rolls and notes), None for everybody.""" to = str(to or "").strip() if not to: return None target = con.execute("""SELECT u.id FROM users u WHERE u.username=? AND (u.id=? OR EXISTS (SELECT 1 FROM lobby_members m WHERE m.lobby_id=? AND m.user_id=u.id))""", (to, lobby["owner_id"], lobby["id"])).fetchone() - if not target or target["id"] == user["id"]: - raise HTTPException(422, "You can only whisper to other people in this lobby") + if not target: + raise HTTPException(422, "You can only whisper to people in this lobby") return target["id"] @@ -796,7 +796,8 @@ def roll_check(lid: str, body: dict = Body(...), user: dict = Depends(current_us payload = {"kind": kind, "what": what, "base": base, "mod": lobby["diff_mod"], "cmod": member["char_mod"], "diff": lobby["diff_label"], "target": target, "roll": roll, "margin": target - roll, "outcome": outcome, "hidden": bool(lobby["diff_hidden"]), "manual": bool(manual)} - mid = _post(con, lid, user["id"], None, "check", payload) + private = str(body.get("to") or "") == user["username"] # a private check is only seen by the roller + mid = _post(con, lid, user["id"], user["id"] if private else None, "check", payload) return {"id": mid, "roll": roll, "outcome": outcome} diff --git a/frontend/src/Lobbies.jsx b/frontend/src/Lobbies.jsx index b635c24..c38e4d0 100644 --- a/frontend/src/Lobbies.jsx +++ b/frontend/src/Lobbies.jsx @@ -177,7 +177,7 @@ function Chat({ me, people, msgs, poll, id, to, setTo }) { const who = (m) => ( <> {m.mine ? 'You' : m.from || '?'} - {m.to && {m.to === m.from ? '(only visible to you, the DM)' : m.mine ? `to ${m.to} (private)` : 'to you (private)'}} + {m.to && {m.to === m.from ? '(private, only you)' : m.mine ? `to ${m.to} (private)` : 'to you (private)'}} > ) @@ -216,6 +216,7 @@ function Chat({ me, people, msgs, poll, id, to, setTo }) {