Skip to content

Commit

Permalink
Fix replies to me are not included in V[RS]TL if withReplies is disab…
Browse files Browse the repository at this point in the history
…led (#31)

* fix: reply to me is not shown on V[RS]TL

* docs(changelog): Fix replies to me are not included in V[RS]TL if withReplies is disabled
  • Loading branch information
anatawa12 authored Jun 14, 2024
1 parent cbfb898 commit aa00eb8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-VRTL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

This file lists changes to VRTL Generic Branch.

- Fix replies to me are not included in V\[RS]TL if withReplies is disabled.
- Add `vmimiRelayTimelineImplemented` and `disableVmimiRelayTimeline` to nodeinfo
1 change: 1 addition & 0 deletions packages/backend/src/core/FanoutTimelineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type FanoutTimelineName =
| 'vmimiRelayTimeline' // replies are not included
| 'vmimiRelayTimelineWithFiles' // only non-reply notes with files are included
| 'vmimiRelayTimelineWithReplies' // only replies are included
| `vmimiRelayTimelineWithReplyTo:${string}` // Only replies to specific local user are included. Parameter is reply user id.

@Injectable()
export class FanoutTimelineService {
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ export class NoteCreateService implements OnApplicationShutdown {
}
if (note.visibility === 'public' && this.vmimiRelayTimelineService.isRelayedInstance(note.userHost)) {
this.fanoutTimelineService.push('vmimiRelayTimelineWithReplies', note.id, meta.vmimiRelayTimelineCacheMax, r);
if (note.replyUserHost == null) {
this.fanoutTimelineService.push(`vmimiRelayTimelineWithReplyTo:${note.replyUserId}`, note.id, meta.vmimiRelayTimelineCacheMax / 10, r);
}
}
} else {
this.fanoutTimelineService.push(`userTimeline:${user.id}`, note.id, note.userHost == null ? meta.perLocalUserUserTimelineCacheMax : meta.perRemoteUserUserTimelineCacheMax, r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
timelineConfig = [
`homeTimeline:${me.id}`,
'vmimiRelayTimeline',
`vmimiRelayTimelineWithReplyTo:${me.id}`,
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
redisTimelines:
ps.withFiles ? ['vmimiRelayTimelineWithFiles']
: ps.withReplies ? ['vmimiRelayTimeline', 'vmimiRelayTimelineWithReplies']
: me ? ['vmimiRelayTimeline', `vmimiRelayTimelineWithReplyTo:${me.id}`]
: ['vmimiRelayTimeline'],
alwaysIncludeMyNotes: true,
excludePureRenotes: !ps.withRenotes,
Expand Down

0 comments on commit aa00eb8

Please sign in to comment.