From cadfb24a8db3d8d5e13b849dcedc16939ff09a08 Mon Sep 17 00:00:00 2001 From: rene Date: Sun, 7 Jun 2026 17:43:42 +0200 Subject: [PATCH] Partner-Freigabe: Live-Vorschau im Admin + Mail-Fehler sichtbar machen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rene: 'kann nichts prüfen — ich würde den Output erwarten, der auf der Partner-Seite zu sehen sein wird'. Freigabe-Zeile hat jetzt einen Vorschau-Toggle, der die Karte 1:1 wie auf #partner rendert (Logo/Initial, Slogan, Website, Instagram, Bio, Medien-Grid). Mail-Ursache gefunden: Staging-.env fehlte SMTP_SUPPORT_USER → Code-Default support@banyaro.de → 535 Auth-Fehler, vom Silent-Catch verschluckt. .env ergänzt (partner@banyaro.app wie Prod); Submit loggt SMTP-Fehler jetzt über _log_smtp_failure in failed_emails statt still zu schlucken. --- VERSION | 2 +- backend/routes/partner.py | 18 ++++---- backend/static/index.html | 24 +++++----- backend/static/js/app.js | 2 +- backend/static/js/pages/admin.js | 76 +++++++++++++++++++++++++------- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 7 files changed, 84 insertions(+), 42 deletions(-) diff --git a/VERSION b/VERSION index b8d1607..832d4ca 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1255 \ No newline at end of file +1256 \ No newline at end of file diff --git a/backend/routes/partner.py b/backend/routes/partner.py index b73ae1a..dff79c9 100644 --- a/backend/routes/partner.py +++ b/backend/routes/partner.py @@ -481,20 +481,18 @@ def submit_partner_profile(user=Depends(require_partner)): (user["id"],) ) profile = _pp_get_or_empty(conn, user["id"]) - # Admin benachrichtigen (best effort — Silent-Skip ohne ADMIN_EMAIL) + # Admin benachrichtigen — Fehler landen in failed_emails (Admin-Retry), kein Silent-Skip admin_email = os.getenv("ADMIN_EMAIL", "") if admin_email and profile.get("approved") != 1: + subject = f"[Ban Yaro] Partner-Profil eingereicht: {profile.get('display_name')}" + body = (f"Partner {user['name']} ({user['email']}) hat sein Profil zur " + f"Freigabe eingereicht.\n\nAdmin-Panel: https://banyaro.app/#admin") try: from routes.outreach import _send_smtp - _send_smtp( - admin_email, - f"[Ban Yaro] Partner-Profil eingereicht: {profile.get('display_name')}", - (f"Partner {user['name']} ({user['email']}) hat sein Profil zur " - f"Freigabe eingereicht.\n\nAdmin-Panel: https://banyaro.app/#admin"), - "support", - ) - except Exception: - pass + _send_smtp(admin_email, subject, body, "support") + except Exception as exc: + from routes.auth import _log_smtp_failure + _log_smtp_failure(admin_email, subject, body, exc, context="partner_profile_submit") return {"profile": profile} diff --git a/backend/static/index.html b/backend/static/index.html index da8b74c..ac806cb 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,14 +86,14 @@ Ban Yaro - + - - - - - + + + + + @@ -612,11 +612,11 @@ - - - - - + + + + + @@ -626,7 +626,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index f6bd714..77b177d 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '1255'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1256'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator) window.APP_VERSION = APP_VERSION; diff --git a/backend/static/js/pages/admin.js b/backend/static/js/pages/admin.js index cd992a5..21d2f92 100644 --- a/backend/static/js/pages/admin.js +++ b/backend/static/js/pages/admin.js @@ -2395,23 +2395,60 @@ window.Page_admin = (() => { ${profiles.length === 0 ? `

Noch keine Partner-Profile angelegt.

` : profiles.map(p => ` -
- ${p.logo_url - ? `` - : `
`} -
-
${UI.escape(p.display_name || p.name)}
-
${UI.escape(p.name)} · ${UI.escape(p.email)}${p.photos?.length ? ` · ${p.photos.length} Medien` : ''}
+
+
+ ${p.logo_url + ? `` + : `
`} +
+
${UI.escape(p.display_name || p.name)}
+
${UI.escape(p.name)} · ${UI.escape(p.email)}${p.photos?.length ? ` · ${p.photos.length} Medien` : ''}
+
+ ${p.approved === 1 + ? `✓ Frei` + : p.approved === -1 + ? `✗ Abgelehnt` + : p.submitted_at + ? `⏳ Prüfen` + : `Entwurf`} + + ${p.approved !== 1 ? `` : ''} + ${p.approved !== -1 ? `` : ''} +
+ + - ${p.approved === 1 - ? `✓ Frei` - : p.approved === -1 - ? `✗ Abgelehnt` - : p.submitted_at - ? `⏳ Prüfen` - : `Entwurf`} - ${p.approved !== 1 ? `` : ''} - ${p.approved !== -1 ? `` : ''}
`).join('')}
@@ -2446,6 +2483,13 @@ window.Page_admin = (() => {
`; + // Partner-Profil-Vorschau auf-/zuklappen (.hidden hat !important → classList) + el.querySelectorAll('.adm-pp-preview').forEach(btn => { + btn.addEventListener('click', () => { + el.querySelector(`#adm-pp-preview-${btn.dataset.uid}`)?.classList.toggle('hidden'); + }); + }); + // Partner-Profil freigeben / ablehnen el.querySelectorAll('.adm-pp-review').forEach(btn => { btn.addEventListener('click', async () => { diff --git a/backend/static/landing.html b/backend/static/landing.html index 2d5176f..a693e89 100644 --- a/backend/static/landing.html +++ b/backend/static/landing.html @@ -4,7 +4,7 @@ - + Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz diff --git a/backend/static/sw.js b/backend/static/sw.js index 8b178df..2782ffa 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -4,7 +4,7 @@ ============================================================ */ // ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab -const VER = '1255'; +const VER = '1256'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten