fix(participants): show Me contextually per logged-in user

Participant id=1 was named "Me" in the DB, causing Sonu and other users
to see "Me" referring to Siddharth when viewing splits and shared expenses.

- Rename participant id=1 from "Me" to "Siddharth" in the DB
- /api/participants now substitutes "Me" for whichever participant matches
  the current user, so the label is always relative to the viewer
- split-modal: default split uses currentUser.id instead of name === "Me"
- transactions/page: filter and display logic uses participant ID not name
- shared/page: split chips show "Me" when participant_id === current user

Also includes add-transaction-modal tags support (pre-existing staged change).
This commit is contained in:
2026-04-01 18:36:29 +11:00
parent 0a1f6b48a2
commit 7491e70a15
5 changed files with 90 additions and 15 deletions
+4 -3
View File
@@ -218,7 +218,7 @@ function MarkAsPaymentModal({
const { data: me } = useCurrentUser();
const record = useRecordPayment();
const others = participants.filter((p) => p.name !== "Me");
const others = participants.filter((p) => p.id !== me?.id);
const [participantId, setParticipantId] = useState<number | "">(others[0]?.id ?? "");
@@ -517,6 +517,7 @@ function TransactionsContent() {
const { data, isLoading } = useTransactions(filters);
const { data: banks } = useBanks();
const { data: tags } = useTags();
const { data: me } = useCurrentUser();
const { data: statementInfo } = useStatement(parseInt(filters.statement_id) || 0);
const updateTxn = useUpdateTransaction();
const bulkAction = useBulkAction();
@@ -851,7 +852,7 @@ function TransactionsContent() {
</td>
<td className="p-2 whitespace-nowrap">
<div className="flex items-center gap-1 flex-wrap">
{t.splits?.filter((s) => s.name !== "Me").map((s) => (
{t.splits?.filter((s) => s.participant_id !== me?.id).map((s) => (
<span
key={s.participant_id}
className={`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${
@@ -865,7 +866,7 @@ function TransactionsContent() {
<button
onClick={() => setSplitModal({ transactionId: t.id, amount: t.amount, description: t.description, merchant: t.effective_merchant || undefined, transactionIds: undefined })}
className={`text-xs px-2 py-0.5 rounded transition-colors ${
t.splits?.some((s) => s.name !== "Me")
t.splits?.some((s) => s.participant_id !== me?.id)
? "text-amber-400 hover:text-amber-200 hover:bg-zinc-800"
: "text-zinc-500 hover:text-zinc-200 hover:bg-zinc-800"
}`}