Feature: Forum-Beiträge von Freunden im Aktivitäts-Feed + Deep-Link

- 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)
This commit is contained in:
rene 2026-04-19 11:04:26 +02:00
parent f9e2202ac7
commit 82d9e26823
3 changed files with 26 additions and 2 deletions

View file

@ -277,6 +277,25 @@ async def get_activity(user=Depends(get_current_user)):
LIMIT 15 LIMIT 15
""", friend_ids).fetchall() """, 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) # Neue Hunde (angelegt in den letzten 30 Tagen)
new_dog_rows = conn.execute(f""" new_dog_rows = conn.execute(f"""
SELECT SELECT
@ -300,6 +319,7 @@ async def get_activity(user=Depends(get_current_user)):
"health": "heart", "health": "heart",
"walk": "paw-print", "walk": "paw-print",
"new_dog": "dog", "new_dog": "dog",
"forum": "push-pin",
} }
_TEXT = { _TEXT = {
"health": "Hat einen Gesundheitseintrag hinzugefügt", "health": "Hat einen Gesundheitseintrag hinzugefügt",
@ -307,7 +327,7 @@ async def get_activity(user=Depends(get_current_user)):
} }
items = [] 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) d = dict(row)
t = d["type"] t = d["type"]
items.append({ items.append({

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung. 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 = (() => { const App = (() => {

View file

@ -208,6 +208,7 @@ window.Page_friends = (() => {
{ key: 'alle', label: 'Alle' }, { key: 'alle', label: 'Alle' },
{ key: 'diary', label: 'Tagebuch' }, { key: 'diary', label: 'Tagebuch' },
{ key: 'walk', label: 'Gassi-Treffen' }, { key: 'walk', label: 'Gassi-Treffen' },
{ key: 'forum', label: 'Forum' },
{ key: 'health', label: 'Gesundheit' }, { key: 'health', label: 'Gesundheit' },
{ key: 'new_dog', label: 'Neuer Hund' }, { key: 'new_dog', label: 'Neuer Hund' },
]; ];
@ -257,6 +258,8 @@ window.Page_friends = (() => {
App.callModule('diary', 'openDetail', entryId); App.callModule('diary', 'openDetail', entryId);
} else if (entryId && type === 'walk') { } else if (entryId && type === 'walk') {
App.callModule('walks', 'openDetail', entryId); App.callModule('walks', 'openDetail', entryId);
} else if (entryId && type === 'forum') {
App.callModule('forum', 'openThread', entryId);
} else { } else {
App.navigate(page); App.navigate(page);
} }
@ -268,6 +271,7 @@ window.Page_friends = (() => {
diary: 'diary', diary: 'diary',
health: 'health', health: 'health',
walk: 'walks', walk: 'walks',
forum: 'forum',
new_dog: null, new_dog: null,
}; };