shared page: expandable receipt details on split transactions
ci / lint-test (push) Successful in 57s

The item list existed only on the owner's transactions page — the person
a meal or order was split WITH could see the amount but never what was in
it. getSharedTransactions now carries the same order_platform LATERAL the
transactions page uses, and rows with a receipt get the same disclosure
arrow + OrderDetails expansion. The shared viewer is a split participant,
so canAccessTransactions already authorises the order API for them; meal
rows keep the verdict UI (the partner records their own), bridge rows
stay review-free.
This commit is contained in:
2026-08-10 18:27:16 +10:00
parent 7f8e363b5b
commit 0e5422919e
2 changed files with 45 additions and 4 deletions
+12 -1
View File
@@ -866,6 +866,11 @@ export async function getSharedTransactions(ownerId: number, tagIds?: number[],
COALESCE(t.owner_id, s.owner_id) as owner_id,
p_owner.name as owner_name,
COALESCE(src.created_at, t.created_at) as created_at,
-- Receipt flag, same LATERAL the transactions page uses: the shared
-- viewer is a split participant, so the order API authorises them —
-- without the flag here the disclosure arrow (and the item list behind
-- it) existed only on the owner's page.
order_ctx.platform as order_platform,
json_agg(json_build_object(
'split_id', ts.id,
'participant_id', ts.participant_id,
@@ -879,6 +884,12 @@ export async function getSharedTransactions(ownerId: number, tagIds?: number[],
LEFT JOIN transaction_overrides o ON o.transaction_id = t.id
LEFT JOIN statements s ON s.id = t.statement_id
LEFT JOIN participants p_owner ON p_owner.id = COALESCE(t.owner_id, s.owner_id)
LEFT JOIN LATERAL (
SELECT em.platform
FROM expense_metadata em
WHERE em.transaction_id = t.id OR em.matched_transaction_id = t.id
LIMIT 1
) order_ctx ON true
LEFT JOIN transactions src ON src.reconciled_with_id = t.id AND src.statement_id IS NULL
WHERE (
(
@@ -892,7 +903,7 @@ export async function getSharedTransactions(ownerId: number, tagIds?: number[],
AND ${EXCLUDE_RECONCILED_SOURCE}
${tagClause}
${participantClause}
GROUP BY t.id, o.category_override, o.merchant_normalized, o.notes, s.bank_name, s.currency, s.owner_id, p_owner.name, src.created_at
GROUP BY t.id, o.category_override, o.merchant_normalized, o.notes, s.bank_name, s.currency, s.owner_id, p_owner.name, src.created_at, order_ctx.platform
ORDER BY t.transaction_date DESC
`, params);