Conversation
- Replace Post entity with primitive fields in PostDeletedEvent - Add toJSON/fromJSON for serialization support - Update all consumers (FediverseBridge, FeedUpdateService, NotificationEventService, GhostPostService) to use new getters - Change FeedService.removePostFromDiscoveryFeeds to accept postId - Change NotificationService.removePostNotifications to accept postId - Register PostDeletedEvent with EventSerializer in app.ts - Add comprehensive unit tests for serialization/deserialization - Update existing tests across all affected services Co-authored-by: Michael Barrett <mike182uk@users.noreply.github.com>
- Remove unused Post import from feed.service.ts - Fix formatting in feed.service.integration.test.ts - Handle nullable apFollowers in post repository event emission Co-authored-by: Michael Barrett <mike182uk@users.noreply.github.com>
|
Cursor Agent can help with this pull request. Just |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| await deleteActivity.toJsonLd(), | ||
| ); | ||
|
|
||
| await this.sendActivityToFollowers(post.author, deleteActivity); |
There was a problem hiding this comment.
@cursoragent Why did you change this to use ctx.sendActivity directly?
| const post = event.getPost(); | ||
| const postId = event.getPostId(); | ||
|
|
||
| if (post.id !== null) { |
There was a problem hiding this comment.
@cursoragent Hm, why did we account for this originally if we don't need to now?
| return this.authorIsInternal; | ||
| } | ||
|
|
||
| static getName(): string { |
There was a problem hiding this comment.
@cursoragent Lets add non-static version whilst we are here
|
|
||
| // Remove the post from discovery feeds | ||
| await feedService.removePostFromDiscoveryFeeds(post); | ||
| await feedService.removePostFromDiscoveryFeeds(post.id as number); |
There was a problem hiding this comment.
Already fixed. The as number was needed because Post.id is typed as number | null, and the method now accepts number. But as number is a blunt type assertion — I've replaced it with post.id!, which is the more idiomatic non-null assertion for cases where we know the post has been saved and therefore has an id.
- Revert to using sendActivityToFollowers in FediverseBridge instead of inlining ctx.sendActivity directly - Add non-static getName() instance method to PostDeletedEvent - Replace 'as number' casts with non-null assertions in tests - Add test for instance getName() method Co-authored-by: Michael Barrett <mike182uk@users.noreply.github.com>


Refactor
PostDeletedEventto implementSerializableEventand use primitive data to comply with ADR-0011 and ensure event data persistence after post deletion.The
PostDeletedEventpreviously contained the fullPostentity, which is problematic for deletion events as the post may no longer exist in the database when the event is processed. This change ensures all necessary data for federation and other consumers is explicitly stored as primitive, serializable fields within the event itself.Linear Issue: BER-3166