Refactor (#7394)
* wip * wip * wip * wip * wip * Update define.ts * Update update.ts * Update user.ts * wip * wip * Update request.ts * URL * wip * wip * wip * wip * Update invite.ts * Update create.ts
This commit is contained in:
@@ -79,7 +79,7 @@ export class NoteRepository extends Repository<Note> {
|
||||
|
||||
public async pack(
|
||||
src: Note['id'] | Note,
|
||||
me?: User['id'] | User | null | undefined,
|
||||
me?: { id: User['id'] } | null | undefined,
|
||||
options?: {
|
||||
detail?: boolean;
|
||||
skipHide?: boolean;
|
||||
@@ -93,7 +93,7 @@ export class NoteRepository extends Repository<Note> {
|
||||
skipHide: false
|
||||
}, options);
|
||||
|
||||
const meId = me ? typeof me === 'string' ? me : me.id : null;
|
||||
const meId = me ? me.id : null;
|
||||
const note = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
||||
const host = note.userHost;
|
||||
|
||||
@@ -174,7 +174,7 @@ export class NoteRepository extends Repository<Note> {
|
||||
id: note.id,
|
||||
createdAt: note.createdAt.toISOString(),
|
||||
userId: note.userId,
|
||||
user: Users.pack(note.user || note.userId, meId, {
|
||||
user: Users.pack(note.user || note.userId, me, {
|
||||
detail: false,
|
||||
}),
|
||||
text: text,
|
||||
@@ -204,12 +204,12 @@ export class NoteRepository extends Repository<Note> {
|
||||
_prId_: (note as any)._prId_ || undefined,
|
||||
|
||||
...(opts.detail ? {
|
||||
reply: note.replyId ? this.pack(note.reply || note.replyId, meId, {
|
||||
reply: note.replyId ? this.pack(note.reply || note.replyId, me, {
|
||||
detail: false,
|
||||
_hint_: options?._hint_
|
||||
}) : undefined,
|
||||
|
||||
renote: note.renoteId ? this.pack(note.renote || note.renoteId, meId, {
|
||||
renote: note.renoteId ? this.pack(note.renote || note.renoteId, me, {
|
||||
detail: true,
|
||||
_hint_: options?._hint_
|
||||
}) : undefined,
|
||||
@@ -236,7 +236,7 @@ export class NoteRepository extends Repository<Note> {
|
||||
|
||||
public async packMany(
|
||||
notes: Note[],
|
||||
me?: User['id'] | User | null | undefined,
|
||||
me?: { id: User['id'] } | null | undefined,
|
||||
options?: {
|
||||
detail?: boolean;
|
||||
skipHide?: boolean;
|
||||
@@ -244,7 +244,7 @@ export class NoteRepository extends Repository<Note> {
|
||||
) {
|
||||
if (notes.length === 0) return [];
|
||||
|
||||
const meId = me ? typeof me === 'string' ? me : me.id : null;
|
||||
const meId = me ? me.id : null;
|
||||
const myReactionsMap = new Map<Note['id'], NoteReaction | null>();
|
||||
if (meId) {
|
||||
const renoteIds = notes.filter(n => n.renoteId != null).map(n => n.renoteId!);
|
||||
|
Reference in New Issue
Block a user