This commit is contained in:
syuilo
2022-09-19 03:11:50 +09:00
parent 92c78218bc
commit a2eac9fff6
82 changed files with 671 additions and 671 deletions

View File

@@ -68,7 +68,7 @@ export class NoteEntityService implements OnModuleInit {
this.reactionService = this.moduleRef.get('ReactionService');
}
async #hideNote(packedNote: Packed<'Note'>, meId: User['id'] | null) {
private async hideNote(packedNote: Packed<'Note'>, meId: User['id'] | null) {
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
let hide = false;
@@ -128,7 +128,7 @@ export class NoteEntityService implements OnModuleInit {
}
}
async #populatePoll(note: Note, meId: User['id'] | null) {
private async populatePoll(note: Note, meId: User['id'] | null) {
const poll = await this.pollsRepository.findOneByOrFail({ noteId: note.id });
const choices = poll.choices.map(c => ({
text: c,
@@ -166,7 +166,7 @@ export class NoteEntityService implements OnModuleInit {
};
}
async #populateMyReaction(note: Note, meId: User['id'], _hint_?: {
private async populateMyReaction(note: Note, meId: User['id'], _hint_?: {
myReactions: Map<Note['id'], NoteReaction | null>;
}) {
if (_hint_?.myReactions) {
@@ -319,10 +319,10 @@ export class NoteEntityService implements OnModuleInit {
_hint_: options?._hint_,
}) : undefined,
poll: note.hasPoll ? this.#populatePoll(note, meId) : undefined,
poll: note.hasPoll ? this.populatePoll(note, meId) : undefined,
...(meId ? {
myReaction: this.#populateMyReaction(note, meId, options?._hint_),
myReaction: this.populateMyReaction(note, meId, options?._hint_),
} : {}),
} : {}),
});
@@ -339,7 +339,7 @@ export class NoteEntityService implements OnModuleInit {
}
if (!opts.skipHide) {
await this.#hideNote(packed, meId);
await this.hideNote(packed, meId);
}
return packed;

View File

@@ -48,7 +48,7 @@ export class UserEntityService implements OnModuleInit {
private pageEntityService: PageEntityService;
private customEmojiService: CustomEmojiService;
private antennaService: AntennaService;
#userInstanceCache: Cache<Instance | null>;
private userInstanceCache: Cache<Instance | null>;
constructor(
private moduleRef: ModuleRef,
@@ -119,7 +119,7 @@ export class UserEntityService implements OnModuleInit {
//private customEmojiService: CustomEmojiService,
//private antennaService: AntennaService,
) {
this.#userInstanceCache = new Cache<Instance | null>(1000 * 60 * 60 * 3);
this.userInstanceCache = new Cache<Instance | null>(1000 * 60 * 60 * 3);
}
onModuleInit() {
@@ -384,7 +384,7 @@ export class UserEntityService implements OnModuleInit {
isModerator: user.isModerator ?? falsy,
isBot: user.isBot ?? falsy,
isCat: user.isCat ?? falsy,
instance: user.host ? this.#userInstanceCache.fetch(user.host,
instance: user.host ? this.userInstanceCache.fetch(user.host,
() => this.instancesRepository.findOneBy({ host: user.host! }),
v => v != null,
).then(instance => instance ? {