fix: guest link URL format - use path /guest/:eventId instead of query params
This commit is contained in:
parent
c50544d4bd
commit
71b6828807
@ -726,12 +726,10 @@ async def send_wedding_invitation_single(
|
||||
partner1 = event.partner1_name or ""
|
||||
partner2 = event.partner2_name or ""
|
||||
|
||||
# Build guest link (customize per your deployment)
|
||||
guest_link = (
|
||||
event.guest_link or
|
||||
f"https://invy.dvirlabs.com/guest?event={event_id}" or
|
||||
f"https://localhost:5173/guest?event={event_id}"
|
||||
)
|
||||
# Build guest link as clean /guest/<event_id> path so the frontend
|
||||
# regex can reliably extract the event_id from the URL.
|
||||
_gl_base = (event.guest_link or "https://invy.dvirlabs.com/guest").split("?")[0].rstrip("/")
|
||||
guest_link = f"{_gl_base}/{event_id}"
|
||||
|
||||
service = get_whatsapp_service()
|
||||
result = await service.send_wedding_invitation(
|
||||
@ -840,9 +838,12 @@ async def send_wedding_invitation_bulk(
|
||||
|
||||
# Build per-guest link — always unique per event + guest so that
|
||||
# a guest invited to multiple events gets a distinct URL each time.
|
||||
_base = (event.guest_link or "https://invy.dvirlabs.com/guest").rstrip("/")
|
||||
_sep = "&" if "?" in _base else "?"
|
||||
per_guest_link = f"{_base}{_sep}event={event_id}&guest_id={guest.id}"
|
||||
# Build a clean /guest/<event_id> path URL so the frontend regex
|
||||
# /^\/guest\/([a-f0-9-]{36})/ can reliably extract the event_id.
|
||||
_frontend_base = (event.guest_link or "https://invy.dvirlabs.com/guest").rstrip("/")
|
||||
# Strip any existing ?event= / ?guest_id= to avoid double params
|
||||
_frontend_base = _frontend_base.split("?")[0].rstrip("/")
|
||||
per_guest_link = f"{_frontend_base}/{event_id}"
|
||||
|
||||
params = {
|
||||
"contact_name": guest_name, # always auto from guest
|
||||
|
||||
@ -60,9 +60,12 @@ function App() {
|
||||
return
|
||||
}
|
||||
|
||||
// Handle guest self-service mode (legacy — no event ID)
|
||||
// Handle guest self-service mode — also check ?event= query param (sent in WhatsApp body text)
|
||||
if (path === '/guest' || path === '/guest/') {
|
||||
setRsvpEventId(null)
|
||||
// Try to extract event ID from ?event=<uuid> or ?event_id=<uuid> query param
|
||||
const eventFromQuery =
|
||||
params.get('event') || params.get('event_id') || null
|
||||
setRsvpEventId(eventFromQuery)
|
||||
setCurrentPage('guest-self-service')
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user