diff --git a/frontend/src/app.css b/frontend/src/app.css
index bff661e..47b850e 100644
--- a/frontend/src/app.css
+++ b/frontend/src/app.css
@@ -811,6 +811,20 @@ form input[type="file"] {
#chat-list li {
padding: 0.3rem 0;
}
+/* Benachrichtigungen: ganzer Eintrag ist der Link, ohne Unterstreichung;
+ Typ fett, darunter Auszug und Datum. */
+#notification-list {
+ list-style: none;
+ padding: 0;
+}
+#notification-list li {
+ padding: 0.8rem 0;
+}
+#notification-list a {
+ display: flex;
+ flex-direction: column;
+ text-decoration: none;
+}
/* Nachrichten wie Beiträge (Meta-Zeile, Text), aber nicht klickbar. */
.message {
padding: 0.4rem 0;
diff --git a/frontend/src/docs/info.html b/frontend/src/docs/info.html
index 812897c..9ffa4ff 100644
--- a/frontend/src/docs/info.html
+++ b/frontend/src/docs/info.html
@@ -23,6 +23,7 @@
Beiträge und Chats: Das Datum steht jetzt rechts in der Kopfzeile
Neu: Benachrichtigungen. Antwortet jemand auf deinen Beitrag, zählt die Glocke in der Navigation mit; ein Klick auf die Meldung führt zur Antwort
Benachrichtigungen nennen jetzt den Handle der Antwortenden und melden auch, wenn jemand deinen Beitrag repostet
+
Benachrichtigungen übersichtlicher: was passiert ist fett, darunter Auszug und Datum, mehr Abstand, keine Unterstreichung
07.11.2026
diff --git a/frontend/src/notifications.ts b/frontend/src/notifications.ts
index e54e97f..3586d8c 100644
--- a/frontend/src/notifications.ts
+++ b/frontend/src/notifications.ts
@@ -9,7 +9,10 @@ import { useMe } from "./auth";
export type Notification = {
id: number;
kind: "reply" | "bump";
+ // Was passiert ist, etwa "@bob hat auf deinen Beitrag geantwortet."
message: string;
+ // Anfang des zitierten Beitrags, '' = keiner.
+ excerpt: string;
// Interner Pfad, etwa /e/123.
link: string;
created_at: number;
diff --git a/frontend/src/pages/NotificationsPage.tsx b/frontend/src/pages/NotificationsPage.tsx
index 7355456..15469bd 100644
--- a/frontend/src/pages/NotificationsPage.tsx
+++ b/frontend/src/pages/NotificationsPage.tsx
@@ -6,7 +6,8 @@ import { formatTime } from "../format";
import { useNotifications } from "../notifications";
// NotificationsPage listet die jüngsten Benachrichtigungen; ein Klick führt
-// zum Beitrag. Was beim Öffnen noch ungesehen war, steht fett.
+// zum Beitrag. Fett steht, was passiert ist, darunter Auszug und Datum; was
+// beim Öffnen noch ungesehen war, trägt "neu".
export function NotificationsPage() {
const me = useMe();
return (
@@ -28,9 +29,14 @@ function NotificationList() {
diff --git a/internal/httpapi/notifications.go b/internal/httpapi/notifications.go
index d0bf312..54523f1 100644
--- a/internal/httpapi/notifications.go
+++ b/internal/httpapi/notifications.go
@@ -25,6 +25,7 @@ type notificationJSON struct {
ID int64 `json:"id"`
Kind string `json:"kind"`
Message string `json:"message"`
+ Excerpt string `json:"excerpt"`
Link string `json:"link"`
CreatedAt int64 `json:"created_at"`
Seen bool `json:"seen"`
@@ -40,21 +41,18 @@ func excerpt(content string) string {
return e
}
-// notificationMessage setzt den Text zusammen. actor ist der Handle dessen,
-// der geantwortet hat; leer (Reposts, unbekannt) heißt "Jemand".
-func notificationMessage(kind, actor, excerpt string) string {
+// notificationMessage ist die Zeile, die sagt, was passiert ist. actor ist
+// der Handle dessen, der geantwortet hat; leer (Reposts, unbekannt) heißt
+// "Jemand". Den Auszug liefert die API getrennt.
+func notificationMessage(kind, actor string) string {
who := "Jemand"
if actor != "" {
who = "@" + actor
}
- msg := who + " hat deinen Beitrag repostet."
if kind == "reply" {
- msg = who + " hat auf deinen Beitrag geantwortet."
+ return who + " hat auf deinen Beitrag geantwortet."
}
- if excerpt != "" {
- msg += " (" + excerpt + ")"
- }
- return msg
+ return who + " hat deinen Beitrag repostet."
}
// notifyReply benachrichtigt den Autor des Elternbeitrags über die Antwort
@@ -107,11 +105,11 @@ func (s *Server) handleNotifications(w http.ResponseWriter, r *http.Request) err
list := []notificationJSON{}
for rows.Next() {
var n notificationJSON
- var actor, excerpt string
- if err := rows.Scan(&n.ID, &n.Kind, &actor, &excerpt, &n.Link, &n.CreatedAt, &n.Seen); err != nil {
+ var actor string
+ if err := rows.Scan(&n.ID, &n.Kind, &actor, &n.Excerpt, &n.Link, &n.CreatedAt, &n.Seen); err != nil {
return apperr.Internal(err)
}
- n.Message = notificationMessage(n.Kind, actor, excerpt)
+ n.Message = notificationMessage(n.Kind, actor)
list = append(list, n)
}
if err := rows.Err(); err != nil {
diff --git a/internal/httpapi/notifications_test.go b/internal/httpapi/notifications_test.go
index 41a936a..a511200 100644
--- a/internal/httpapi/notifications_test.go
+++ b/internal/httpapi/notifications_test.go
@@ -47,8 +47,8 @@ func TestNotifyReply(t *testing.T) {
t.Fatalf("liste: %+v", list)
}
n := list.Notifications[0]
- wantMsg := "@bob hat auf deinen Beitrag geantwortet. (" + strings.TrimSpace(long[:50]) + "…)"
- if n.Kind != "reply" || n.Link != fmt.Sprintf("/e/%d", answer) || n.Seen || n.Message != wantMsg {
+ if n.Kind != "reply" || n.Link != fmt.Sprintf("/e/%d", answer) || n.Seen ||
+ n.Message != "@bob hat auf deinen Beitrag geantwortet." || n.Excerpt != strings.TrimSpace(long[:50])+"…" {
t.Errorf("benachrichtigung: %+v", n)
}
// Das Ansehen der Liste markiert alles als gesehen.
@@ -68,8 +68,8 @@ func TestNotifyReply(t *testing.T) {
resp = postForm(t, bob, srv.URL+"/api/user/handle", url.Values{"handle": {"robert"}})
resp.Body.Close()
getAs(t, alice, srv.URL+"/api/notifications", &list)
- if got := list.Notifications[0].Message; got != "@robert hat auf deinen Beitrag geantwortet. (neu)" {
- t.Errorf("nach Bearbeiten und Umbenennen: %q", got)
+ if n := list.Notifications[0]; n.Message != "@robert hat auf deinen Beitrag geantwortet." || n.Excerpt != "neu" {
+ t.Errorf("nach Bearbeiten und Umbenennen: %+v", n)
}
resp = postForm(t, bob, fmt.Sprintf("%s/api/entry/%d/delete", srv.URL, answer), nil)
resp.Body.Close()
@@ -105,7 +105,7 @@ func TestNotifyBump(t *testing.T) {
n := list.Notifications[0]
// Wer repostet, wird nicht gespeichert: "Jemand", auch wenn es bob war.
if n.Kind != "bump" || n.Link != fmt.Sprintf("/e/%d", mine) ||
- n.Message != "Jemand hat deinen Beitrag repostet. (mein erster beitrag)" {
+ n.Message != "Jemand hat deinen Beitrag repostet." || n.Excerpt != "mein erster beitrag" {
t.Errorf("benachrichtigung: %+v", n)
}
}
diff --git a/notes/api.md b/notes/api.md
index 24c1481..aa68e4a 100644
--- a/notes/api.md
+++ b/notes/api.md
@@ -209,12 +209,12 @@ sie stündlich. Senden ist gedrosselt (60/min pro IP).
Zwei Arten (`kind`):
- `reply`: jemand hat auf einen eigenen Beitrag geantwortet (nicht bei
- Antworten an sich selbst), etwa „@bob hat auf deinen Beitrag geantwortet.
- (Anfang der Antwort…)“; `link` führt zur Antwort. Der Handle ist der
+ Antworten an sich selbst), `message` etwa „@bob hat auf deinen Beitrag
+ geantwortet.“, `excerpt` der Anfang der Antwort; `link` führt zur Antwort. Der Handle ist der
aktuelle, auch nach einer Umbenennung.
- `bump`: jemand hat einen eigenen Beitrag repostet (nicht beim eigenen
- Repost): „Jemand hat deinen Beitrag repostet. (Anfang des Beitrags…)“.
- Wer repostet, speichert der Server nicht.
+ Repost): „Jemand hat deinen Beitrag repostet.“, `excerpt` der Anfang des
+ Beitrags. Wer repostet, speichert der Server nicht.
Der Auszug umfasst die ersten 50 Zeichen. Wird der zitierte Beitrag
bearbeitet, zieht er nach; wird er gelöscht (auch mit dem Konto), verschwindet
@@ -222,7 +222,7 @@ die Benachrichtigung.
| Methode | Pfad | Auth | Request | Erfolg |
|---|---|---|---|---|
-| GET | `/api/notifications` | ✓ | – | `200 {"notifications":[{"id","kind","message","link","created_at","seen"}]}`, die 50 jüngsten, neueste zuerst; `seen` ist der Stand vor dem Abruf, der Abruf markiert alle gelieferten als gesehen |
+| GET | `/api/notifications` | ✓ | – | `200 {"notifications":[{"id","kind","message","excerpt","link","created_at","seen"}]}`, die 50 jüngsten, neueste zuerst; `seen` ist der Stand vor dem Abruf, der Abruf markiert alle gelieferten als gesehen |
| GET | `/api/notifications/unread` | ✓ | – | `200 {"unread"}`: Zahl der ungesehenen |
## Statistik