refactor: prefix Mi for all entities (misskey-dev#11719) (MisskeyIO#160)
cheery-pick from misskey-dev@792622aeadf3e36d50cddec3c64b2ff0105ea927
This commit is contained in:
parent
651905e08f
commit
58bbff3738
234 changed files with 2061 additions and 2061 deletions
|
@ -11,9 +11,9 @@ import { DI } from '@/di-symbols.js';
|
|||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { nyaize } from '@/misc/nyaize.js';
|
||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
import type { Note } from '@/models/entities/Note.js';
|
||||
import type { NoteReaction } from '@/models/entities/NoteReaction.js';
|
||||
import type { MiUser } from '@/models/entities/User.js';
|
||||
import type { MiNote } from '@/models/entities/Note.js';
|
||||
import type { MiNoteReaction } from '@/models/entities/NoteReaction.js';
|
||||
import type {
|
||||
ChannelsRepository,
|
||||
DriveFilesRepository,
|
||||
|
@ -84,7 +84,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private async hideNote(packedNote: Packed<'Note'>, meId: User['id'] | null) {
|
||||
private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null) {
|
||||
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
|
||||
let hide = false;
|
||||
|
||||
|
@ -143,7 +143,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private async populatePoll(note: Note, meId: User['id'] | null) {
|
||||
private async populatePoll(note: MiNote, meId: MiUser['id'] | null) {
|
||||
const poll = await this.pollsRepository.findOneByOrFail({ noteId: note.id });
|
||||
const choices = poll.choices.map(c => ({
|
||||
text: c,
|
||||
|
@ -182,8 +182,8 @@ export class NoteEntityService implements OnModuleInit {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private async populateMyReaction(note: Note, meId: User['id'], _hint_?: {
|
||||
myReactions: Map<Note['id'], NoteReaction | null>;
|
||||
private async populateMyReaction(note: MiNote, meId: MiUser['id'], _hint_?: {
|
||||
myReactions: Map<MiNote['id'], MiNoteReaction | null>;
|
||||
}) {
|
||||
if (_hint_?.myReactions) {
|
||||
const reaction = _hint_.myReactions.get(note.id);
|
||||
|
@ -213,7 +213,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async isVisibleForMe(note: Note, meId: User['id'] | null): Promise<boolean> {
|
||||
public async isVisibleForMe(note: MiNote, meId: MiUser['id'] | null): Promise<boolean> {
|
||||
// This code must always be synchronized with the checks in generateVisibilityQuery.
|
||||
// visibility が specified かつ自分が指定されていなかったら非表示
|
||||
if (note.visibility === 'specified') {
|
||||
|
@ -268,9 +268,9 @@ export class NoteEntityService implements OnModuleInit {
|
|||
|
||||
@bindThis
|
||||
public async packAttachedFiles(
|
||||
fileIds: Note['fileIds'],
|
||||
packedFiles: Map<Note['fileIds'][number], Packed<'DriveFile'> | null>,
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
fileIds: MiNote['fileIds'],
|
||||
packedFiles: Map<MiNote['fileIds'][number], Packed<'DriveFile'> | null>,
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
): Promise<Packed<'DriveFile'>[]> {
|
||||
const missingIds = [];
|
||||
for (const id of fileIds) {
|
||||
|
@ -287,14 +287,14 @@ export class NoteEntityService implements OnModuleInit {
|
|||
|
||||
@bindThis
|
||||
public async pack(
|
||||
src: Note['id'] | Note,
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
src: MiNote['id'] | MiNote,
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: {
|
||||
detail?: boolean;
|
||||
skipHide?: boolean;
|
||||
_hint_?: {
|
||||
myReactions: Map<Note['id'], NoteReaction | null>;
|
||||
packedFiles: Map<Note['fileIds'][number], Packed<'DriveFile'> | null>;
|
||||
myReactions: Map<MiNote['id'], MiNoteReaction | null>;
|
||||
packedFiles: Map<MiNote['fileIds'][number], Packed<'DriveFile'> | null>;
|
||||
};
|
||||
},
|
||||
): Promise<Packed<'Note'>> {
|
||||
|
@ -404,8 +404,8 @@ export class NoteEntityService implements OnModuleInit {
|
|||
|
||||
@bindThis
|
||||
public async packMany(
|
||||
notes: Note[],
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
notes: MiNote[],
|
||||
me: { id: MiUser['id'] } | null | undefined,
|
||||
options?: {
|
||||
detail?: boolean;
|
||||
skipHide?: boolean;
|
||||
|
@ -414,7 +414,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
if (notes.length === 0) return [];
|
||||
|
||||
const meId = me ? me.id : null;
|
||||
const myReactionsMap = new Map<Note['id'], NoteReaction | null>();
|
||||
const myReactionsMap = new Map<MiNote['id'], MiNoteReaction | null>();
|
||||
if (meId) {
|
||||
const renoteIds = notes.filter(n => n.renoteId != null).map(n => n.renoteId!);
|
||||
// パフォーマンスのためノートが作成されてから1秒以上経っていない場合はリアクションを取得しない
|
||||
|
@ -446,7 +446,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public aggregateNoteEmojis(notes: Note[]) {
|
||||
public aggregateNoteEmojis(notes: MiNote[]) {
|
||||
let emojis: { name: string | null; host: string | null; }[] = [];
|
||||
for (const note of notes) {
|
||||
emojis = emojis.concat(note.emojis
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue