mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Update
This commit is contained in:
1 parent
8acc43981e
commit
118dadc69a
122 files changed
+1688
-218
No files matched your search
@@ -90,35 +90,21 @@ Deno.serve(async (req) => {
|
||||
);
|
||||
}
|
||||
|
||||
// Get sender name
|
||||
const { data: sender } = await supabase
|
||||
.from("profiles")
|
||||
.select("name")
|
||||
.eq("id", sender_id)
|
||||
.single();
|
||||
|
||||
// Get the most recent message from this sender in this match
|
||||
// Get the most recent message ID for navigation
|
||||
const { data: message } = await supabase
|
||||
.from("messages")
|
||||
.select("id, content, media_path")
|
||||
.select("id")
|
||||
.eq("match_id", match_id)
|
||||
.eq("user_id", sender_id)
|
||||
.order("created_at", { ascending: false })
|
||||
.limit(1)
|
||||
.single();
|
||||
|
||||
const senderName = sender?.name || "Your partner";
|
||||
const messagePreview = message?.content
|
||||
? message.content.length > 100
|
||||
? message.content.substring(0, 100) + "..."
|
||||
: message.content
|
||||
: "Sent an image";
|
||||
|
||||
// Build push message
|
||||
// Build push message (privacy-friendly - no content in notification)
|
||||
const pushMessage: ExpoPushMessage = {
|
||||
to: recipient.push_token,
|
||||
title: senderName,
|
||||
body: messagePreview,
|
||||
title: "New message",
|
||||
body: "Your partner sent you a message",
|
||||
sound: "default",
|
||||
data: {
|
||||
type: "message",
|
||||
|
||||
@@ -93,15 +93,13 @@ Deno.serve(async (req) => {
|
||||
.eq("id", match_id)
|
||||
.single();
|
||||
|
||||
// Build push messages
|
||||
// Build push messages (privacy-friendly - no content in notification)
|
||||
const messages: ExpoPushMessage[] = profiles
|
||||
.filter((p) => p.push_token)
|
||||
.map((profile) => ({
|
||||
to: profile.push_token!,
|
||||
title: "It's a match! 💕",
|
||||
body: match?.question?.text
|
||||
? `You both agreed: "${match.question.text.substring(0, 50)}..."`
|
||||
: "You and your partner agreed on something new!",
|
||||
body: "You and your partner matched on something new!",
|
||||
sound: "default",
|
||||
data: { match_id, type: "match" },
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user