From e0ce354edad7036f82af2c299d0ff4813c055ade Mon Sep 17 00:00:00 2001 From: Michelle Date: Thu, 2 Apr 2026 01:03:18 +0200 Subject: [PATCH] feat: improve email invitation label for clarity and add navigation on guest join --- src/i18n/de.json | 2 +- src/i18n/en.json | 2 +- src/pages/GuestJoin.jsx | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/i18n/de.json b/src/i18n/de.json index b7b937b..de4f943 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -518,7 +518,7 @@ "addressLabel": "Benutzeradresse", "addressPlaceholder": "@benutzer@andere-instanz.com", "addressHint": "Format: @Benutzername@Domain der Redlight-Instanz", - "emailLabel": "Oder per E-Mail einladen", + "emailLabel": "Per E-Mail einladen", "emailPlaceholder": "name@beispiel.de, name2@beispiel.de", "emailHint": "Eine oder mehrere E-Mail-Adressen, durch Komma getrennt", "messageLabel": "Nachricht (optional)", diff --git a/src/i18n/en.json b/src/i18n/en.json index 82d4694..035497a 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -518,7 +518,7 @@ "addressLabel": "User address", "addressPlaceholder": "@user@other-instance.com", "addressHint": "Format: @username@domain of the Redlight instance", - "emailLabel": "Or invite by email", + "emailLabel": "Invite by email", "emailPlaceholder": "name@example.com, name2@example.com", "emailHint": "Enter one or more email addresses, separated by commas", "messageLabel": "Message (optional)", diff --git a/src/pages/GuestJoin.jsx b/src/pages/GuestJoin.jsx index 55f2096..2d00292 100644 --- a/src/pages/GuestJoin.jsx +++ b/src/pages/GuestJoin.jsx @@ -1,5 +1,5 @@ import { useState, useEffect, useRef } from 'react'; -import { useParams, Link, useSearchParams } from 'react-router-dom'; +import { useParams, Link, useSearchParams, useNavigate } from 'react-router-dom'; import { Video, User, Lock, Shield, ArrowRight, Loader2, Users, Radio, AlertCircle, FileText, Clock, X } from 'lucide-react'; import BrandLogo from '../components/BrandLogo'; import api from '../services/api'; @@ -11,6 +11,7 @@ import { useBranding } from '../contexts/BrandingContext'; export default function GuestJoin() { const { uid } = useParams(); const [searchParams] = useSearchParams(); + const navigate = useNavigate(); const { t } = useLanguage(); const { user } = useAuth(); const { imprintUrl, privacyUrl } = useBranding(); @@ -60,6 +61,17 @@ export default function GuestJoin() { useEffect(() => { const fetchRoom = async () => { + // If logged in, check if user owns or has access to this room + if (isLoggedIn) { + try { + await api.get(`/rooms/${uid}`); + navigate(`/rooms/${uid}`, { replace: true }); + return; + } catch { + // User doesn't have access — continue as guest + } + } + try { const res = await api.get(`/rooms/${uid}/public`); setRoomInfo(res.data.room);