Skip to content

Commit

Permalink
fix(backend): ロックダウンされた期間指定のノートがStreaming経由でLTLに出現するのを修正 (#15200)
Browse files Browse the repository at this point in the history
* fix(backend): skipHideなときにもロックダウンされたノートのprivate化をするように

* fix linting

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

* Fix: type error

* Remove unneeded await

* Fix: typo

* Remove skipTreatVisibillity
  • Loading branch information
tai-cha authored Jan 8, 2025
1 parent 79b851f commit d783531
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/backend/src/core/entities/NoteEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ export class NoteEntityService implements OnModuleInit {
}

@bindThis
private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null): Promise<void> {
// FIXME: このvisibility変更処理が当関数にあるのは若干不自然かもしれない(関数名を treatVisibility とかに変える手もある)
private treatVisibility(packedNote: Packed<'Note'>): Packed<'Note'>['visibility'] {
if (packedNote.visibility === 'public' || packedNote.visibility === 'home') {
const followersOnlyBefore = packedNote.user.makeNotesFollowersOnlyBefore;
if ((followersOnlyBefore != null)
Expand All @@ -115,7 +114,11 @@ export class NoteEntityService implements OnModuleInit {
packedNote.visibility = 'followers';
}
}
return packedNote.visibility;
}

@bindThis
private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null): Promise<void> {
if (meId === packedNote.userId) return;

// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
Expand Down Expand Up @@ -458,6 +461,8 @@ export class NoteEntityService implements OnModuleInit {
} : {}),
});

this.treatVisibility(packed);

if (!opts.skipHide) {
await this.hideNote(packed, meId);
}
Expand Down

0 comments on commit d783531

Please sign in to comment.