Notifications : réactions et commentaires sur mes avis, activité des comptes suivis
deploy / deploy (push) Successful in 39s

- Quelqu'un réagit (emoji) ou commente mon avis → notification avec le titre ; la toucher ouvre ma fiche
- Un compte que je suis donne son avis, commence une série / un anime / un drama, ou ajoute un titre
  à « À voir » → notification avec l'affiche ; la toucher ouvre sa fiche
- Serveur (migration 20261128180000, appliquée) : déclencheurs sur réactions, commentaires et fiches ;
  rafales (import, ajouts en série) regroupées en une seule notification par personne et par type sur 3 h ;
  jamais entre comptes bloqués ni d'un compte suspendu ; une réaction retirée retire sa notification
- Pas de notification pour les listes perso : elles sont privées
- Textes dans les 18 langues

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
Claude committed 2026-11-28 09:39:28 +00:00
1 parent 2a4261219c
commit 3487e8c305
22 files changed
+322 -27

No files matched your search

+22 -3
View File
@@ -199,8 +199,19 @@ export const getFollowRequests = async () => toCards(await rpc('get_follow_reque
// ─── Notifications (abonnements uniquement) ───
export type NotificationKind = 'new_follower' | 'follow_request' | 'unfollow' | 'follow_accepted'
const NOTIFICATION_KINDS: NotificationKind[] = ['new_follower', 'follow_request', 'unfollow', 'follow_accepted']
export type NotificationKind =
| 'new_follower'
| 'follow_request'
| 'unfollow'
| 'follow_accepted'
| 'reaction'
| 'review_comment'
| 'friend_review'
| 'friend_started'
| 'friend_added'
const NOTIFICATION_KINDS: NotificationKind[] = ['new_follower', 'follow_request', 'unfollow', 'follow_accepted', 'reaction', 'review_comment', 'friend_review', 'friend_started', 'friend_added']
/** Notifications liées à un titre : celui de la personne, ou le mien (réaction / commentaire sur mon avis) */
export const MINE_ITEM_KINDS: NotificationKind[] = ['reaction', 'review_comment']
export interface FollowNotification {
id: number
@@ -208,6 +219,10 @@ export interface FollowNotification {
createdAt: string
read: boolean
actor: ProfileCard
/** Titre concerné (fiche publique) */
item?: MediaItem
/** Réaction choisie */
emoji?: string
}
export async function getNotifications(): Promise<FollowNotification[]> {
@@ -217,7 +232,11 @@ export async function getNotifications(): Promise<FollowNotification[]> {
if (!isPlainObject(n) || typeof n.id !== 'number' || !NOTIFICATION_KINDS.includes(n.kind as NotificationKind)) return []
const actor = toCard(n.actor)
const createdAt = safeIso(n.created_at)
return actor && createdAt ? [{ id: n.id, kind: n.kind as NotificationKind, createdAt, read: n.read === true, actor }] : []
const item = n.item == null ? undefined : (othersItem(n.item) ?? undefined)
// Notification liée à un titre devenu invisible : on ne l'affiche pas
if (n.item != null && !item) return []
const emoji = typeof n.emoji === 'string' && n.emoji.length <= 16 ? n.emoji : undefined
return actor && createdAt ? [{ id: n.id, kind: n.kind as NotificationKind, createdAt, read: n.read === true, actor, item, emoji }] : []
})
}