From 82d9e268233346e6803ec85c38569839a9565ba6 Mon Sep 17 00:00:00 2001 From: rene Date: Sun, 19 Apr 2026 11:04:26 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20Forum-Beitr=C3=A4ge=20von=20Freunden?= =?UTF-8?q?=20im=20Aktivit=C3=A4ts-Feed=20+=20Deep-Link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - friends.py: forum_threads im Activity-Feed (mit entry_id) - Filter-Chip 'Forum' ergänzt - Klick öffnet direkt den Forum-Thread via App.callModule('forum','openThread',id) --- backend/routes/friends.py | 22 +++++++++++++++++++++- backend/static/js/app.js | 2 +- backend/static/js/pages/friends.js | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/backend/routes/friends.py b/backend/routes/friends.py index 8db5701..ccb9b72 100644 --- a/backend/routes/friends.py +++ b/backend/routes/friends.py @@ -277,6 +277,25 @@ async def get_activity(user=Depends(get_current_user)): LIMIT 15 """, friend_ids).fetchall() + # Forum-Beiträge der Freunde (öffentliche Threads) + forum_rows = conn.execute(f""" + SELECT + 'forum' AS type, + ft.id AS entry_id, + u.id AS user_id, + u.name AS user_name, + u.avatar_url, + NULL AS dog_name, + NULL AS dog_foto, + ft.titel AS text, + ft.created_at + FROM forum_threads ft + JOIN users u ON u.id = ft.user_id + WHERE ft.user_id IN ({ph}) + ORDER BY ft.created_at DESC + LIMIT 15 + """, friend_ids).fetchall() + # Neue Hunde (angelegt in den letzten 30 Tagen) new_dog_rows = conn.execute(f""" SELECT @@ -300,6 +319,7 @@ async def get_activity(user=Depends(get_current_user)): "health": "heart", "walk": "paw-print", "new_dog": "dog", + "forum": "push-pin", } _TEXT = { "health": "Hat einen Gesundheitseintrag hinzugefügt", @@ -307,7 +327,7 @@ async def get_activity(user=Depends(get_current_user)): } items = [] - for row in [*diary_rows, *health_rows, *walk_rows, *new_dog_rows]: + for row in [*diary_rows, *health_rows, *walk_rows, *forum_rows, *new_dog_rows]: d = dict(row) t = d["type"] items.append({ diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 031ce33..8e46bc5 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 = '220'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '221'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const App = (() => { diff --git a/backend/static/js/pages/friends.js b/backend/static/js/pages/friends.js index da6a40b..50bd5b3 100644 --- a/backend/static/js/pages/friends.js +++ b/backend/static/js/pages/friends.js @@ -208,6 +208,7 @@ window.Page_friends = (() => { { key: 'alle', label: 'Alle' }, { key: 'diary', label: 'Tagebuch' }, { key: 'walk', label: 'Gassi-Treffen' }, + { key: 'forum', label: 'Forum' }, { key: 'health', label: 'Gesundheit' }, { key: 'new_dog', label: 'Neuer Hund' }, ]; @@ -257,6 +258,8 @@ window.Page_friends = (() => { App.callModule('diary', 'openDetail', entryId); } else if (entryId && type === 'walk') { App.callModule('walks', 'openDetail', entryId); + } else if (entryId && type === 'forum') { + App.callModule('forum', 'openThread', entryId); } else { App.navigate(page); } @@ -268,6 +271,7 @@ window.Page_friends = (() => { diary: 'diary', health: 'health', walk: 'walks', + forum: 'forum', new_dog: null, };