fix(backend): ロックダウンされた期間指定のノートがStreaming経由でLTLに出現するのを修正 (#15200)

* fix(backend): skipHideなときにもロックダウンされたノートのprivate化をするように

* fix linting

* Update packages/backend/src/core/entities/NoteEntityService.ts

* Fix: type error

* Remove unneeded await

* Fix: typo

* Remove skipTreatVisibillity
This commit is contained in:
taichan 2025-01-08 14:33:08 +09:00 committed by GitHub
parent 79b851fe56
commit d7835313c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,8 +102,7 @@ export class NoteEntityService implements OnModuleInit {
} }
@bindThis @bindThis
private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null): Promise<void> { private treatVisibility(packedNote: Packed<'Note'>): Packed<'Note'>['visibility'] {
// FIXME: このvisibility変更処理が当関数にあるのは若干不自然かもしれない(関数名を treatVisibility とかに変える手もある)
if (packedNote.visibility === 'public' || packedNote.visibility === 'home') { if (packedNote.visibility === 'public' || packedNote.visibility === 'home') {
const followersOnlyBefore = packedNote.user.makeNotesFollowersOnlyBefore; const followersOnlyBefore = packedNote.user.makeNotesFollowersOnlyBefore;
if ((followersOnlyBefore != null) if ((followersOnlyBefore != null)
@ -115,7 +114,11 @@ export class NoteEntityService implements OnModuleInit {
packedNote.visibility = 'followers'; packedNote.visibility = 'followers';
} }
} }
return packedNote.visibility;
}
@bindThis
private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null): Promise<void> {
if (meId === packedNote.userId) return; if (meId === packedNote.userId) return;
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど) // TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
@ -458,6 +461,8 @@ export class NoteEntityService implements OnModuleInit {
} : {}), } : {}),
}); });
this.treatVisibility(packed);
if (!opts.skipHide) { if (!opts.skipHide) {
await this.hideNote(packed, meId); await this.hideNote(packed, meId);
} }