fix: replace .single() with .maybeSingle() in 5 more routes (PR 3/3)#477
fix: replace .single() with .maybeSingle() in 5 more routes (PR 3/3)#477tankgxy wants to merge 1 commit into
Conversation
…ials, verification, video-calls, wallet/zap
Greptile SummaryThis is the third in a series of PRs migrating Supabase queries from
Confidence Score: 3/5Not safe to merge as-is — testimonial emails and zap notifications will display corrupted characters, and a crash path exists in the video-call creation flow. The encoding corruption in
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Route as API Route
participant Supabase
note over Route,Supabase: Before PR — .single()
Client->>Route: Request
Route->>Supabase: query.single()
alt 0 rows
Supabase-->>Route: error (PGRST116)
Route-->>Client: 400 / unhandled throw
else 1 row
Supabase-->>Route: data row
Route-->>Client: 200 OK
end
note over Route,Supabase: After PR — .maybeSingle()
Client->>Route: Request
Route->>Supabase: query.maybeSingle()
alt 0 rows
Supabase-->>Route: "data = null, error = null"
Route-->>Client: handled gracefully (null check)
else 1 row
Supabase-->>Route: data row
Route-->>Client: 200 OK
else insert + RLS blocks read-back (video-calls)
Supabase-->>Route: "data = null, error = null"
Route->>Route: call.id → TypeError (crash)
Route-->>Client: 500 Error
end
|
|
|
||
| const authorName = authorProfile?.full_name || authorProfile?.username || "Someone"; | ||
| const stars = "★".repeat(rating) + "☆".repeat(5 - rating); | ||
| const stars = "�?.repeat(rating) + "�?.repeat(5 - rating); |
There was a problem hiding this comment.
Corrupted emoji characters in
stars variable
The ★ and ☆ characters have been replaced with garbled/replacement bytes (?). As written, the stars variable will contain corrupted characters repeated rating times rather than actual star glyphs. This string appears in the HTML email body (line 230) and the email subject (line 227), so every testimonial notification email will show garbage characters instead of a star rating like ★★★☆☆.
| title: "You received a zap! �?, | ||
| body: `${senderName} zapped you ${recipient_amount.toLocaleString()} sats`, | ||
| data: { zap_id: zapId, amount_sats: recipient_amount, target_type, target_id }, | ||
| }); | ||
| } else { | ||
| await (admin.from("notifications") as any).insert({ | ||
| user_id: recipient_id, | ||
| type: "zap_received", | ||
| title: "You received a zap! ⚡", | ||
| title: "You received a zap! �?, | ||
| body: `${senderName} zapped you ${recipient_amount.toLocaleString()} sats. Add a Lightning Address to your profile to withdraw.`, |
There was a problem hiding this comment.
Corrupted ⚡ emoji in notification titles
The lightning bolt emoji ⚡ in both "You received a zap! ⚡" notification title strings has been replaced with garbled replacement bytes. Every zap notification sent to recipients (both the ln_address and non-ln_address branches) will display a corrupted character instead of the emoji. The title field is user-visible in the in-app notification UI.
Subscriptions, testimonials, verification, video-calls, wallet/zap routes.