Skip to content

feat(notification): tell an author when their post is quoted - #241

Closed
aquie00t wants to merge 1 commit into
feature/post-quote-countfrom
feature/post-quote-notification
Closed

feat(notification): tell an author when their post is quoted#241
aquie00t wants to merge 1 commit into
feature/post-quote-countfrom
feature/post-quote-notification

Conversation

@aquie00t

Copy link
Copy Markdown
Collaborator

Alıntı özelliğinin üçüncü PR'ı. Base'i main değil, #240'ın dalı (feature/post-quote-count) — zincir tek seferde merge edilip tek deploy olacak.

Ne değişti

  • NotificationType.QUOTE — Prisma enum + domain enum + migration. HTTP şeması FBType.Enum(NotificationType) kullandığı için kendiliğinden kazandı.
  • NotifyQuotedAuthorUseCaseNotifyNewPostUseCase'in kardeşi: alıntılanan postun yazarını kendi çözüyor, bildirimi yazıyor ve realtime olayı gönderiyor.
  • CreatePostUseCase — commit sonrası, mevcut takipçi fan-out'unun yanında fire-and-forget çağrı.

Kararlar

  • Bildirim alıntıyı işaret ediyor, orijinali değil. Alıcı zaten kendi postunu biliyor; açmak istediği şey hakkında söylenen. Alıntı, orijinali zaten kart olarak taşıyor. Bunun bedava bir getirisi var: Notification.post cascade'li, yani alıntı silinince bildirim de gidiyor — unlike yolundaki gibi elle temizleme koduna gerek kalmıyor.
  • Transaction'ın dışında, fire-and-forget. LikePostUseCase bildirimi transaction içinde yaratıyor ama oradaki yazma zaten beğeninin kendisi. Burada yazma post; bir bildirim hatası isteği düşürmemeli ya da PR 2'de kurulan yazma transaction'ını geri sardırmamalı.
  • Yazarı notifier'ın kendisi çözüyor. Böylece CreatePostUseCase iki değil bir collaborator kazanıyor ve transaction'ın dönüş şekli değişmiyor. Ekstra okuma kritik yolun dışında.
  • Kendi postunu alıntılamak kimseyi uyandırmıyor.

Doğrulama

  • pnpm test:unit → 895/895 geçti. Yeni: notify-quoted-author.usecase.test.ts (5 durum), create-post'a 3 durum. enums.test.ts'teki "tam 6 değer" iddiası 7'ye güncellendi ve QUOTE için ayrı bir iddia eklendi.
  • pnpm lint, pnpm format:check, tsc --noEmit temiz.
  • Migration test DB'sine uygulandı — ALTER TYPE ... ADD VALUE Prisma'nın migration transaction'ı içinde sorunsuz koştu (repodaki ilk enum değişikliği, gerekçe migration dosyasında). migrate diff sıfır drift.
  • Gerçek DB'ye karşı smoke, 9/9: yazar tam bir bildirim alıyor, tipi QUOTE, postId alıntıyı işaret ediyor, referenceId onu yansıtıyor, issuer doğru, realtime olayı gidiyor, alıntılayan bildirim almıyor, kendi postunu alıntılamak sessiz kalıyor, alıntı silinince bildirim cascade ile gidiyor.
  • E2E (tests/e2e/notification/quote.test.ts, 4 durum) CI'da koşacak.

Sonraki PR

  • PR 4GET /posts/:id/quotes + metinsiz alıntı (saf repost)

🤖 Generated with Claude Code

https://claude.ai/code/session_015JC6UgjwRSJ3KHToPYqBPC

Being quoted is a louder signal than a like - somebody has said something
about your post to their own followers - and until now it arrived silently,
as a number going up.

The notification leads to the quote rather than to the post being quoted: the
recipient already knows their own post, what they want to open is what was
said about it, and the quote carries the original as its card anyway. That
also buys the cleanup for free, since Notification.post cascades - deleting
the quote takes its notification with it, with no undo path to write.

NotifyQuotedAuthorUseCase sits beside NotifyNewPostUseCase and resolves the
quoted author itself, so post creation gains one collaborator rather than two
and its transaction keeps its shape. It runs after the commit and
fire-and-forget: the post is the thing worth keeping, so a notification
failure is logged rather than allowed to fail the request or roll the write
back. An account quoting itself notifies nobody.

First enum change in the repository; the migration carries the note about
ALTER TYPE ... ADD VALUE inside Prisma's migration transaction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015JC6UgjwRSJ3KHToPYqBPC
@aquie00t

Copy link
Copy Markdown
Collaborator Author

Kodu #242'nin squash merge'ü ile main'e girdi (faa97c7) — zincirin tamamı tek commit olarak birleşti. İncelenecek bir fark kalmadığı için kapatıyorum; tartışma bu PR'da okunabilir kalıyor.

@aquie00t aquie00t closed this Aug 30, 2026
@aquie00t
aquie00t deleted the feature/post-quote-notification branch August 30, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant