simple-web-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 84d53239a72d7afd3c77e7ce931b3b308f3f3cab
parent 9a89284e4f37d77bc6408464d46a8d7a2a832aab
Author: Silas Brack <silasbrack@gmail.com>
Date:   Sun,  7 Jun 2026 17:44:52 +0200

fix: filter votes by user_id to show correct voted state

Without filtering by user_id, get_user_votes returned all users'
votes, so the voted indicator was unreliable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Msrc/trailbase.rs | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/trailbase.rs b/src/trailbase.rs @@ -433,7 +433,13 @@ pub async fn get_user_votes( return Ok(vec![]); } + let user_id = client + .tokens() + .and_then(|t| extract_user_id_from_token(&t.auth_token)) + .ok_or_else(|| ClientError::Auth("Not authenticated".into()))?; + let mut filters = vec![ + Filter::new("user_id", CompareOp::Equal, &user_id), Filter::new("target_type", CompareOp::Equal, target_type.to_string()), ];