Aufräumen: Soft-Delete, Benachrichtigungsarten, Antwort-Structs, WebP
Das Soft-Delete-SQL stand zweimal (Beitrag löschen, Konto löschen) und beide Stellen mussten dieselben Nebentabellen kennen; jetzt macht softDeleteEntries das für eine WHERE-Bedingung, die Kontolöschung räumt nur noch ab, was am Nutzer selbst hängt. Die Benachrichtigungsarten waren an fünf Stellen als Literal im SQL und im Go-Code; jetzt Konstanten, die als Parameter mitgehen. Antworten auf Anlegen/Bearbeiten und sessioninfo sind Structs wie der Rest. media: der Import von x/image/webp registriert den Decoder global, die Sonderbehandlung in decodeChecked war daher tot und ihr Kommentar falsch (SaveUpload nahm WebP längst an). Jetzt ein Import mit Kommentar, ein Pfad für alle Formate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -68,8 +68,8 @@ func syncMentions(ctx context.Context, tx *sql.Tx, pid, author, replyTo int64, c
|
||||
return fmt.Errorf("erwähnungen speichern: %w", err)
|
||||
}
|
||||
if _, err := tx.ExecContext(ctx,
|
||||
`DELETE FROM notification WHERE pid = $1 AND kind = 'mention'
|
||||
AND uid NOT IN (SELECT uid FROM mention WHERE pid = $1)`, pid); err != nil {
|
||||
`DELETE FROM notification WHERE pid = $1 AND kind = $2
|
||||
AND uid NOT IN (SELECT uid FROM mention WHERE pid = $1)`, pid, kindMention); err != nil {
|
||||
return fmt.Errorf("erwähnungen abgleichen: %w", err)
|
||||
}
|
||||
after, err := mentionedUIDs(ctx, tx, pid)
|
||||
@@ -89,8 +89,8 @@ func syncMentions(ctx context.Context, tx *sql.Tx, pid, author, replyTo int64, c
|
||||
}
|
||||
if _, err := tx.ExecContext(ctx,
|
||||
`INSERT INTO notification (uid, kind, actor, excerpt, link, pid, created_at)
|
||||
VALUES ($1, 'mention', $2, $3, $4, $5, $6)`,
|
||||
uid, author, excerpt(content), fmt.Sprintf("/e/%d", pid), pid, now); err != nil {
|
||||
VALUES ($1, $7, $2, $3, $4, $5, $6)`,
|
||||
uid, author, excerpt(content), entryLink(pid), pid, now, kindMention); err != nil {
|
||||
return fmt.Errorf("benachrichtigung anlegen: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user