From 0c8a3cfeec2b8b36c9db30b8ab57c26c20936cfc Mon Sep 17 00:00:00 2001 From: Johann150 Date: Tue, 3 Jan 2023 03:51:38 +0100 Subject: [PATCH] server: fix lints --- packages/backend/src/misc/app-lock.ts | 5 +---- packages/backend/src/misc/fetch-meta.ts | 2 +- packages/backend/src/misc/renote.ts | 8 +++++++- packages/backend/src/models/entities/announcement.ts | 8 -------- .../src/models/entities/attestation-challenge.ts | 8 -------- .../backend/src/models/entities/note-thread-muting.ts | 1 - .../src/queue/processors/db/import-custom-emojis.ts | 6 +++--- .../src/queue/processors/system/check-expired.ts | 2 +- .../src/remote/activitypub/kernel/create/note.ts | 2 +- .../backend/src/remote/activitypub/models/person.ts | 6 ++---- .../backend/src/remote/activitypub/models/question.ts | 4 ++-- packages/backend/src/remote/activitypub/perform.ts | 2 +- packages/backend/src/remote/activitypub/request.ts | 5 +++-- .../src/server/api/endpoints/admin/accounts/delete.ts | 6 +++--- .../api/endpoints/admin/announcements/delete.ts | 2 +- .../server/api/endpoints/admin/announcements/list.ts | 2 +- .../api/endpoints/admin/announcements/update.ts | 2 +- .../api/endpoints/admin/delete-all-files-of-a-user.ts | 2 +- .../api/endpoints/admin/drive/clean-remote-files.ts | 2 +- .../src/server/api/endpoints/admin/drive/files.ts | 2 +- .../src/server/api/endpoints/admin/drive/show-file.ts | 2 +- .../src/server/api/endpoints/admin/emoji/copy.ts | 2 +- .../endpoints/admin/federation/delete-all-files.ts | 2 +- .../federation/refresh-remote-instance-metadata.ts | 2 +- .../admin/federation/remove-all-following.ts | 2 +- .../backend/src/server/api/endpoints/admin/meta.ts | 2 +- .../api/endpoints/admin/queue/deliver-delayed.ts | 2 +- .../server/api/endpoints/admin/queue/inbox-delayed.ts | 2 +- .../src/server/api/endpoints/admin/queue/stats.ts | 2 +- .../src/server/api/endpoints/admin/relays/add.ts | 2 +- .../src/server/api/endpoints/admin/relays/list.ts | 2 +- .../src/server/api/endpoints/admin/relays/remove.ts | 2 +- .../src/server/api/endpoints/admin/suspend-user.ts | 6 +++--- packages/backend/src/server/api/endpoints/ap/show.ts | 2 +- .../backend/src/server/api/endpoints/auth/deny.ts | 2 +- .../src/server/api/endpoints/federation/instances.ts | 2 +- .../server/api/endpoints/federation/show-instance.ts | 2 +- .../backend/src/server/api/endpoints/hashtags/list.ts | 2 +- .../backend/src/server/api/endpoints/hashtags/show.ts | 2 +- .../backend/src/server/api/endpoints/i/2fa/done.ts | 2 +- .../src/server/api/endpoints/i/regenerate-token.ts | 2 +- .../src/server/api/endpoints/notes/reactions.ts | 2 +- .../src/server/api/endpoints/notes/translate.ts | 1 - packages/backend/src/server/api/endpoints/reset-db.ts | 2 +- .../src/server/api/endpoints/reset-password.ts | 2 +- .../backend/src/server/api/endpoints/users/clips.ts | 2 +- .../backend/src/server/api/endpoints/users/pages.ts | 2 +- .../backend/src/server/api/endpoints/users/stats.ts | 2 +- packages/backend/src/server/api/error.ts | 11 ++++++----- packages/backend/src/server/api/openapi/schemas.ts | 3 ++- .../backend/src/server/api/private/signup-pending.ts | 2 +- .../backend/src/server/api/stream/channels/admin.ts | 2 +- .../backend/src/server/api/stream/channels/drive.ts | 2 +- .../src/server/api/stream/channels/global-timeline.ts | 2 +- .../src/server/api/stream/channels/home-timeline.ts | 2 +- .../src/server/api/stream/channels/hybrid-timeline.ts | 2 +- .../src/server/api/stream/channels/local-timeline.ts | 2 +- .../backend/src/server/api/stream/channels/main.ts | 2 +- .../src/server/api/stream/channels/messaging-index.ts | 2 +- .../src/server/api/stream/channels/queue-stats.ts | 2 +- .../src/server/api/stream/channels/server-stats.ts | 2 +- packages/backend/src/server/web/index.ts | 3 --- .../src/services/chart/charts/per-user-reactions.ts | 2 +- packages/backend/src/services/create-notification.ts | 2 +- packages/backend/src/services/note/create.ts | 2 +- packages/backend/src/services/note/delete.ts | 4 ++-- 66 files changed, 84 insertions(+), 101 deletions(-) diff --git a/packages/backend/src/misc/app-lock.ts b/packages/backend/src/misc/app-lock.ts index 58e302525..25627fd05 100644 --- a/packages/backend/src/misc/app-lock.ts +++ b/packages/backend/src/misc/app-lock.ts @@ -8,10 +8,7 @@ import { SECOND } from '@/const.js'; */ const retryDelay = 100; -const lock: (key: string, timeout?: number) => Promise<() => void> - = redisClient - ? promisify(redisLock(redisClient, retryDelay)) - : async () => () => { }; +const lock: (key: string, timeout?: number) => Promise<() => void> = promisify(redisLock(redisClient, retryDelay)); /** * Get AP Object lock diff --git a/packages/backend/src/misc/fetch-meta.ts b/packages/backend/src/misc/fetch-meta.ts index 924b44553..edd6265a8 100644 --- a/packages/backend/src/misc/fetch-meta.ts +++ b/packages/backend/src/misc/fetch-meta.ts @@ -3,7 +3,7 @@ import { db } from '@/db/postgre.js'; import { Meta } from '@/models/entities/meta.js'; import { getFetchInstanceMetadataLock } from '@/misc/app-lock.js'; -let cache: Meta; +let cache: Meta | undefined; /** * Performs the primitive database operation to set the server configuration diff --git a/packages/backend/src/misc/renote.ts b/packages/backend/src/misc/renote.ts index 758dcdd05..cd51cd04a 100644 --- a/packages/backend/src/misc/renote.ts +++ b/packages/backend/src/misc/renote.ts @@ -1,5 +1,11 @@ import { Note } from '@/models/entities/note.js'; export function isPureRenote(note: Note): note is Note & { renoteId: string, text: null, fileIds: null | never[], hasPoll: false } { - return note.renoteId != null && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !note.hasPoll; + return note.renoteId != null + && note.text == null + && ( + note.fileIds == null + || note.fileIds.length === 0 + ) + && !note.hasPoll; } diff --git a/packages/backend/src/models/entities/announcement.ts b/packages/backend/src/models/entities/announcement.ts index beb2f8246..f2088455d 100644 --- a/packages/backend/src/models/entities/announcement.ts +++ b/packages/backend/src/models/entities/announcement.ts @@ -32,12 +32,4 @@ export class Announcement { length: 1024, nullable: true, }) public imageUrl: string | null; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } } diff --git a/packages/backend/src/models/entities/attestation-challenge.ts b/packages/backend/src/models/entities/attestation-challenge.ts index 2a99953ee..421a07fce 100644 --- a/packages/backend/src/models/entities/attestation-challenge.ts +++ b/packages/backend/src/models/entities/attestation-challenge.ts @@ -35,12 +35,4 @@ export class AttestationChallenge { default: false, }) public registrationChallenge: boolean; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } } diff --git a/packages/backend/src/models/entities/note-thread-muting.ts b/packages/backend/src/models/entities/note-thread-muting.ts index 90ed0c9f8..709dcbaa6 100644 --- a/packages/backend/src/models/entities/note-thread-muting.ts +++ b/packages/backend/src/models/entities/note-thread-muting.ts @@ -2,7 +2,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typ import { noteNotificationTypes } from 'foundkey-js'; import { id } from '../id.js'; import { User } from './user.js'; -import { Note } from './note.js'; @Entity() @Index(['userId', 'threadId'], { unique: true }) diff --git a/packages/backend/src/queue/processors/db/import-custom-emojis.ts b/packages/backend/src/queue/processors/db/import-custom-emojis.ts index 04d32d230..1d06d5ff8 100644 --- a/packages/backend/src/queue/processors/db/import-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/import-custom-emojis.ts @@ -56,7 +56,7 @@ export async function importCustomEmojis(job: Bull.Job, don name: emojiInfo.name, }); const driveFile = await addFile({ user: null, path: emojiPath, name: record.fileName, force: true }); - const emoji = await Emojis.insert({ + await Emojis.insert({ id: genId(), updatedAt: new Date(), name: emojiInfo.name, @@ -66,13 +66,13 @@ export async function importCustomEmojis(job: Bull.Job, don originalUrl: driveFile.url, publicUrl: driveFile.webpublicUrl ?? driveFile.url, type: driveFile.webpublicType ?? driveFile.type, - }).then(x => Emojis.findOneByOrFail(x.identifiers[0])); + }); } await db.queryResultCache!.remove(['meta_emojis']); cleanup(); - + logger.succ('Imported'); done(); }); diff --git a/packages/backend/src/queue/processors/system/check-expired.ts b/packages/backend/src/queue/processors/system/check-expired.ts index ba344b712..eeb6149bb 100644 --- a/packages/backend/src/queue/processors/system/check-expired.ts +++ b/packages/backend/src/queue/processors/system/check-expired.ts @@ -2,7 +2,7 @@ import Bull from 'bull'; import { In, LessThan } from 'typeorm'; import { AttestationChallenges, AuthSessions, Mutings, Notifications, PasswordResetRequests, Signins } from '@/models/index.js'; import { publishUserEvent } from '@/services/stream.js'; -import { MINUTE, DAY, MONTH } from '@/const.js'; +import { MINUTE, MONTH } from '@/const.js'; import { queueLogger } from '@/queue/logger.js'; const logger = queueLogger.createSubLogger('check-expired'); diff --git a/packages/backend/src/remote/activitypub/kernel/create/note.ts b/packages/backend/src/remote/activitypub/kernel/create/note.ts index 0b71566ba..892dbb26a 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/note.ts @@ -4,7 +4,7 @@ import { extractDbHost } from '@/misc/convert-host.js'; import { StatusError } from '@/misc/fetch.js'; import { Resolver } from '@/remote/activitypub/resolver.js'; import { createNote, fetchNote } from '@/remote/activitypub/models/note.js'; -import { getApId, IObject, ICreate } from '@/remote/activitypub/type.js'; +import { getApId, IObject } from '@/remote/activitypub/type.js'; /** * 投稿作成アクティビティを捌きます diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 0136aeea3..ed099d03e 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -1,4 +1,3 @@ -import { URL } from 'node:url'; import promiseLimit from 'promise-limit'; import config from '@/config/index.js'; @@ -40,7 +39,6 @@ const summaryLength = 2048; * @param uri Fetch target URI */ function validateActor(x: IObject): IActor { - if (x == null) { throw new Error('invalid Actor: object is null'); } @@ -100,7 +98,7 @@ function validateActor(x: IObject): IActor { * * If the target Person is registered in FoundKey, it is returned. */ -export async function fetchPerson(uri: string, resolver: Resolver): Promise { +export async function fetchPerson(uri: string): Promise { if (typeof uri !== 'string') throw new Error('uri is not string'); const cached = uriPersonCache.get(uri); @@ -384,7 +382,7 @@ export async function resolvePerson(uri: string, resolver: Resolver): Promise x.name!); + .map(x => x.name!); const votes = question[multiple ? 'anyOf' : 'oneOf']! - .map((x, i) => x.replies && x.replies.totalItems || x._misskey_votes || 0); + .map(x => x.replies && x.replies.totalItems || x._misskey_votes || 0); return { choices, diff --git a/packages/backend/src/remote/activitypub/perform.ts b/packages/backend/src/remote/activitypub/perform.ts index 37fd2fc12..8622d43df 100644 --- a/packages/backend/src/remote/activitypub/perform.ts +++ b/packages/backend/src/remote/activitypub/perform.ts @@ -16,4 +16,4 @@ export async function perform(actor: CacheableRemoteUser, activity: IObject, res }); } } -}; +} diff --git a/packages/backend/src/remote/activitypub/request.ts b/packages/backend/src/remote/activitypub/request.ts index 7116e8c8e..233bc025f 100644 --- a/packages/backend/src/remote/activitypub/request.ts +++ b/packages/backend/src/remote/activitypub/request.ts @@ -30,14 +30,15 @@ export async function request(user: { id: User['id'] }, url: string, object: any // don't allow redirects on the inbox redirect: 'error', }); -}; +} /** * Get AP object with http-signature * @param user http-signature user * @param url URL to fetch */ -export async function signedGet(url: string, user: { id: User['id'] }): Promise { +export async function signedGet(_url: string, user: { id: User['id'] }): Promise { + let url = _url; const keypair = await getUserKeypair(user.id); for (let redirects = 0; redirects < 3; redirects++) { diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index 7c0392e3c..b8a8b0618 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -23,20 +23,20 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const user = await Users.findOneBy({ id: ps.userId }); if (user == null) { throw new ApiError('NO_SUCH_USER'); } else if (user.isAdmin) { throw new ApiError('IS_ADMIN'); - } else if(user.isModerator) { + } else if (user.isModerator) { throw new ApiError('IS_MODERATOR'); } if (Users.isLocalUser(user)) { // 物理削除する前にDelete activityを送信する - await doPostSuspend(user).catch(e => {}); + await doPostSuspend(user).catch(() => {}); createDeleteAccountJob(user, { soft: false, diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index 656d4c553..c2e5ccf24 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -20,7 +20,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const announcement = await Announcements.findOneBy({ id: ps.id }); if (announcement == null) throw new ApiError('NO_SUCH_ANNOUNCEMENT'); diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index 7a5758d75..1ffce9fbe 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -84,6 +84,6 @@ export default define(meta, paramDef, async (ps) => { title: announcement.title, text: announcement.text, imageUrl: announcement.imageUrl, - reads: reads.get(announcement)!, + reads: reads.get(announcement), })); }); diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index 6cc94ce3b..341e5636b 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -23,7 +23,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const announcement = await Announcements.findOneBy({ id: ps.id }); if (announcement == null) throw new ApiError('NO_SUCH_ANNOUNCEMENT'); diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 21870a29b..b6b2b7872 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -18,7 +18,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const files = await DriveFiles.findBy({ userId: ps.userId, }); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 4ee5c113b..b36623293 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -15,6 +15,6 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async () => { createCleanRemoteFilesJob(); }); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index ba32aac43..5fcda7614 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -39,7 +39,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(DriveFiles.createQueryBuilder('file'), ps.sinceId, ps.untilId); if (ps.userId) { diff --git a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts index 9f36e6f30..f0c3ea7c0 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts @@ -163,7 +163,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const file = ps.fileId ? await DriveFiles.findOneBy({ id: ps.fileId }) : await DriveFiles.findOne({ where: [{ url: ps.url, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index a13a47376..a098217b4 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -37,7 +37,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const emoji = await Emojis.findOneBy({ id: ps.emojiId }); if (emoji == null) throw new ApiError('NO_SUCH_EMOJI'); diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index b5d7ec673..91a23e90f 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -18,7 +18,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const files = await DriveFiles.findBy({ userHost: ps.host, }); diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index 439a802e1..a043d4601 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -22,7 +22,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const instance = await Instances.findOneBy({ host: toPuny(ps.host) }); if (instance == null) { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 5e60e37a1..34d894b34 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -18,7 +18,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const followings = await Followings.findBy({ followerHost: ps.host, }); diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 57e60f1c6..ba3159112 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -256,7 +256,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async () => { const instance = await fetchMeta(true); return { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index 646e2e7cc..b89360720 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -39,7 +39,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps) => { +export default define(meta, paramDef, async () => { const jobs = await deliverQueue.getJobs(['delayed']); const res = [] as [string, number][]; diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index a8a2d3d42..274313f8a 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -39,7 +39,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps) => { +export default define(meta, paramDef, async () => { const jobs = await inboxQueue.getJobs(['delayed']); const res = [] as [string, number][]; diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index 988b5a5e3..7a0d6bdb7 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -38,7 +38,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps) => { +export default define(meta, paramDef, async () => { const deliverJobCounts = await deliverQueue.getJobCounts(); const inboxJobCounts = await inboxQueue.getJobCounts(); const dbJobCounts = await dbQueue.getJobCounts(); diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index 5fbce5411..76a89ef3d 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -49,7 +49,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { try { if (new URL(ps.inbox).protocol !== 'https:') throw new ApiError('INVALID_URL', 'https only'); } catch (e) { diff --git a/packages/backend/src/server/api/endpoints/admin/relays/list.ts b/packages/backend/src/server/api/endpoints/admin/relays/list.ts index c90e9875f..2bc42f74a 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/list.ts @@ -46,6 +46,6 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async () => { return await listRelay(); }); diff --git a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts index efd7b9a82..5dcf241b1 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/remove.ts @@ -17,6 +17,6 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { return await removeRelay(ps.inbox); }); diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 473fa220e..9527f7edf 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -50,9 +50,9 @@ export default define(meta, paramDef, async (ps, me) => { } (async () => { - await doPostSuspend(user).catch(e => {}); - await unFollowAll(user).catch(e => {}); - await readAllNotify(user).catch(e => {}); + await doPostSuspend(user).catch(() => {}); + await unFollowAll(user).catch(() => {}); + await readAllNotify(user).catch(() => {}); })(); }); diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 7770e1220..414f71d31 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -6,7 +6,7 @@ import { extractDbHost } from '@/misc/convert-host.js'; import { Users, Notes } from '@/models/index.js'; import { Note } from '@/models/entities/note.js'; import { CacheableLocalUser, User } from '@/models/entities/user.js'; -import { isActor, isPost, getApId } from '@/remote/activitypub/type.js'; +import { isActor, isPost } from '@/remote/activitypub/type.js'; import { SchemaType } from '@/misc/schema.js'; import { HOUR } from '@/const.js'; import { shouldBlockInstance } from '@/misc/should-block-instance.js'; diff --git a/packages/backend/src/server/api/endpoints/auth/deny.ts b/packages/backend/src/server/api/endpoints/auth/deny.ts index b3bb4ab8c..2c0f7abc8 100644 --- a/packages/backend/src/server/api/endpoints/auth/deny.ts +++ b/packages/backend/src/server/api/endpoints/auth/deny.ts @@ -27,7 +27,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { const result = await AuthSessions.delete({ token: ps.token, }); diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index b0b2280f8..900f9480b 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -36,7 +36,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const query = Instances.createQueryBuilder('instance'); switch (ps.sort) { diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index 22923d5df..a293bd586 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -26,7 +26,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const instance = await Instances .findOneBy({ host: toPuny(ps.host) }); diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 4277410c8..5f0d9152c 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -30,7 +30,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const query = Hashtags.createQueryBuilder('tag'); if (ps.attachedToUserOnly) query.andWhere('tag.attachedUsersCount != 0'); diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index e66661a68..a3d8b5b98 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -26,7 +26,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { const hashtag = await Hashtags.findOneBy({ name: normalizeForSearch(ps.tag) }); if (hashtag == null) throw new ApiError('NO_SUCH_HASHTAG'); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index 3800290b7..e9fdd4c37 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -1,7 +1,7 @@ import * as speakeasy from 'speakeasy'; import { UserProfiles } from '@/models/index.js'; -import define from '../../../define.js'; import { ApiError } from '@/server/api/error.js'; +import define from '../../../define.js'; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts index 2bec1ed17..84bfa6fd3 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -1,8 +1,8 @@ import { comparePassword } from '@/misc/password.js'; import { publishInternalEvent, publishMainStream, publishUserEvent } from '@/services/stream.js'; import { Users, UserProfiles } from '@/models/index.js'; -import generateUserToken from '../../common/generate-native-user-token.js'; import { ApiError } from '@/server/api/error.js'; +import generateUserToken from '../../common/generate-native-user-token.js'; import define from '../../define.js'; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index 03fe4bd42..6fd0e8f16 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -51,7 +51,7 @@ export const paramDef = { // eslint-disable-next-line import/no-default-export export default define(meta, paramDef, async (ps, user) => { // check note visibility - const note = await getNote(ps.noteId, user).catch(err => { + await getNote(ps.noteId, user).catch(err => { if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError('NO_SUCH_NOTE'); throw err; }); diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index 0d7ce97c1..1c4989354 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -3,7 +3,6 @@ import fetch from 'node-fetch'; import config from '@/config/index.js'; import { getAgentByUrl } from '@/misc/fetch.js'; import { fetchMeta } from '@/misc/fetch-meta.js'; -import { Notes } from '@/models/index.js'; import { TranslationService } from '@/models/entities/meta.js'; import { ApiError } from '../../error.js'; import { getNote } from '../../common/getters.js'; diff --git a/packages/backend/src/server/api/endpoints/reset-db.ts b/packages/backend/src/server/api/endpoints/reset-db.ts index ce26e28ee..b8f969bd5 100644 --- a/packages/backend/src/server/api/endpoints/reset-db.ts +++ b/packages/backend/src/server/api/endpoints/reset-db.ts @@ -17,7 +17,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async () => { if (process.env.NODE_ENV !== 'test') throw new ApiError('ACCESS_DENIED'); await resetDb(); diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index c46fcb6fd..d45b20945 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -28,7 +28,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { const req = await PasswordResetRequests.findOneBy({ token: ps.token, }); diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index 09fdf27c2..0d3706d7e 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -30,7 +30,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(Clips.createQueryBuilder('clip'), ps.sinceId, ps.untilId) .andWhere('clip.userId = :userId', { userId: ps.userId }) .andWhere('clip.isPublic = true'); diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index b1d28af84..4bfafbdb4 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -30,7 +30,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, user) => { +export default define(meta, paramDef, async (ps) => { const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId) .andWhere('page.userId = :userId', { userId: ps.userId }) .andWhere('page.visibility = \'public\''); diff --git a/packages/backend/src/server/api/endpoints/users/stats.ts b/packages/backend/src/server/api/endpoints/users/stats.ts index f17ff8b31..0f99e56b3 100644 --- a/packages/backend/src/server/api/endpoints/users/stats.ts +++ b/packages/backend/src/server/api/endpoints/users/stats.ts @@ -110,7 +110,7 @@ export const paramDef = { } as const; // eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { +export default define(meta, paramDef, async (ps) => { const user = await Users.findOneBy({ id: ps.userId }); if (user == null) { throw new ApiError('NO_SUCH_USER'); diff --git a/packages/backend/src/server/api/error.ts b/packages/backend/src/server/api/error.ts index be9f4aef8..c015c7608 100644 --- a/packages/backend/src/server/api/error.ts +++ b/packages/backend/src/server/api/error.ts @@ -10,15 +10,16 @@ export class ApiError extends Error { code: keyof errors = 'INTERNAL_ERROR', info?: any | null, ) { + let _info = info, _code = code; if (!(code in errors)) { - info = `Unknown error "${code}" occurred.`; - code = 'INTERNAL_ERROR'; + _code = 'INTERNAL_ERROR'; + _info = `Unknown error "${code}" occurred.`; } - const { message, httpStatusCode } = errors[code]; + const { message, httpStatusCode } = errors[_code]; super(message); - this.code = code; - this.info = info; + this.code = _code; + this.info = _info; this.message = message; this.httpStatusCode = httpStatusCode; } diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts index 04346c53b..f03da1c4d 100644 --- a/packages/backend/src/server/api/openapi/schemas.ts +++ b/packages/backend/src/server/api/openapi/schemas.ts @@ -4,7 +4,8 @@ export function convertSchemaToOpenApiSchema(schema: Schema) { const res: any = schema; if (schema.type === 'object' && schema.properties) { - res.required = Object.entries(schema.properties).filter(([k, v]) => !v.optional).map(([k]) => k); + res.required = Object.entries(schema.properties) + .flatMap(([k, v]) => v.optional ? [] : [k]); for (const k of Object.keys(schema.properties)) { res.properties[k] = convertSchemaToOpenApiSchema(schema.properties[k]); diff --git a/packages/backend/src/server/api/private/signup-pending.ts b/packages/backend/src/server/api/private/signup-pending.ts index 53fd2058a..09505a895 100644 --- a/packages/backend/src/server/api/private/signup-pending.ts +++ b/packages/backend/src/server/api/private/signup-pending.ts @@ -11,7 +11,7 @@ export default async (ctx: Koa.Context) => { try { const pendingUser = await UserPendings.findOneByOrFail({ code }); - const { account, secret } = await signup({ + const { account } = await signup({ username: pendingUser.username, passwordHash: pendingUser.password, }); diff --git a/packages/backend/src/server/api/stream/channels/admin.ts b/packages/backend/src/server/api/stream/channels/admin.ts index 945182ea1..007b459df 100644 --- a/packages/backend/src/server/api/stream/channels/admin.ts +++ b/packages/backend/src/server/api/stream/channels/admin.ts @@ -5,7 +5,7 @@ export default class extends Channel { public static shouldShare = true; public static requireCredential = true; - public async init(params: any) { + public async init() { // Subscribe admin stream this.subscriber.on(`adminStream:${this.user!.id}`, data => { this.send(data); diff --git a/packages/backend/src/server/api/stream/channels/drive.ts b/packages/backend/src/server/api/stream/channels/drive.ts index 140255acd..d7ccab5d8 100644 --- a/packages/backend/src/server/api/stream/channels/drive.ts +++ b/packages/backend/src/server/api/stream/channels/drive.ts @@ -5,7 +5,7 @@ export default class extends Channel { public static shouldShare = true; public static requireCredential = true; - public async init(params: any) { + public async init() { // Subscribe drive stream this.subscriber.on(`driveStream:${this.user!.id}`, data => { this.send(data); diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 6b6f69dfe..cefb80033 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -17,7 +17,7 @@ export default class extends Channel { this.onNote = this.withPackedNote(this.onPackedNote.bind(this)); } - public async init(params: any) { + public async init() { const meta = await fetchMeta(); if (meta.disableGlobalTimeline) { if (this.user == null || (!this.user.isAdmin && !this.user.isModerator)) return; diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index e4a5bfd43..1dc81cdbc 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -16,7 +16,7 @@ export default class extends Channel { this.onNote = this.withPackedNote(this.onPackedNote.bind(this)); } - public async init(params: any) { + public async init() { // Subscribe events this.subscriber.on('notesStream', this.onNote); } diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 989e70590..e9e60a7c9 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -17,7 +17,7 @@ export default class extends Channel { this.onNote = this.withPackedNote(this.onPackedNote.bind(this)); } - public async init(params: any) { + public async init() { const meta = await fetchMeta(); if (meta.disableLocalTimeline && !this.user!.isAdmin && !this.user!.isModerator) return; diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 3aa76e389..84524a154 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -16,7 +16,7 @@ export default class extends Channel { this.onNote = this.withPackedNote(this.onPackedNote.bind(this)); } - public async init(params: any) { + public async init() { const meta = await fetchMeta(); if (meta.disableLocalTimeline) { if (this.user == null || (!this.user.isAdmin && !this.user.isModerator)) return; diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts index 70da75e04..f95ca62c8 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -6,7 +6,7 @@ export default class extends Channel { public static shouldShare = true; public static requireCredential = true; - public async init(params: any) { + public async init() { // Subscribe main stream channel this.subscriber.on(`mainStream:${this.user!.id}`, async data => { switch (data.type) { diff --git a/packages/backend/src/server/api/stream/channels/messaging-index.ts b/packages/backend/src/server/api/stream/channels/messaging-index.ts index b930785d2..1498e8649 100644 --- a/packages/backend/src/server/api/stream/channels/messaging-index.ts +++ b/packages/backend/src/server/api/stream/channels/messaging-index.ts @@ -5,7 +5,7 @@ export default class extends Channel { public static shouldShare = true; public static requireCredential = true; - public async init(params: any) { + public async init() { // Subscribe messaging index stream this.subscriber.on(`messagingIndexStream:${this.user!.id}`, data => { this.send(data); diff --git a/packages/backend/src/server/api/stream/channels/queue-stats.ts b/packages/backend/src/server/api/stream/channels/queue-stats.ts index b67600474..f3dc7d668 100644 --- a/packages/backend/src/server/api/stream/channels/queue-stats.ts +++ b/packages/backend/src/server/api/stream/channels/queue-stats.ts @@ -14,7 +14,7 @@ export default class extends Channel { this.onMessage = this.onMessage.bind(this); } - public async init(params: any) { + public async init() { ev.addListener('queueStats', this.onStats); } diff --git a/packages/backend/src/server/api/stream/channels/server-stats.ts b/packages/backend/src/server/api/stream/channels/server-stats.ts index db75a6fa3..7369bbefd 100644 --- a/packages/backend/src/server/api/stream/channels/server-stats.ts +++ b/packages/backend/src/server/api/stream/channels/server-stats.ts @@ -14,7 +14,7 @@ export default class extends Channel { this.onMessage = this.onMessage.bind(this); } - public async init(params: any) { + public async init() { ev.addListener('serverStats', this.onStats); } diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index 1c33fde10..3776c24f2 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -485,9 +485,6 @@ router.get('/_info_card_', async ctx => { }); }); -const override = (source: string, target: string, depth = 0) => - [, ...target.split('/').filter(x => x), ...source.split('/').filter(x => x).splice(depth)].join('/'); - router.get('/flush', async ctx => { await ctx.render('flush'); }); diff --git a/packages/backend/src/services/chart/charts/per-user-reactions.ts b/packages/backend/src/services/chart/charts/per-user-reactions.ts index 6e9c12f87..27345b99d 100644 --- a/packages/backend/src/services/chart/charts/per-user-reactions.ts +++ b/packages/backend/src/services/chart/charts/per-user-reactions.ts @@ -13,7 +13,7 @@ export default class PerUserReactionsChart extends Chart { super(name, schema, true); } - protected async tickMajor(group: string): Promise>> { + protected async tickMajor(): Promise>> { return {}; } diff --git a/packages/backend/src/services/create-notification.ts b/packages/backend/src/services/create-notification.ts index bbb4ab356..30499ce4c 100644 --- a/packages/backend/src/services/create-notification.ts +++ b/packages/backend/src/services/create-notification.ts @@ -1,6 +1,6 @@ import { publishMainStream } from '@/services/stream.js'; import { pushNotification } from '@/services/push-notification.js'; -import { Notifications, Mutings, UserProfiles, Users } from '@/models/index.js'; +import { Notifications, Mutings, UserProfiles } from '@/models/index.js'; import { genId } from '@/misc/gen-id.js'; import { User } from '@/models/entities/user.js'; import { Notification } from '@/models/entities/notification.js'; diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index 4b4a80733..67f5e0d57 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -656,7 +656,7 @@ async function createMentionedEvents(mentionedUsers: MinimumUser[], note: Note, } } -function saveReply(reply: Note, note: Note): void { +function saveReply(reply: Note): void { Notes.increment({ id: reply.id }, 'repliesCount', 1); } diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index faa079e95..6075f15b1 100644 --- a/packages/backend/src/services/note/delete.ts +++ b/packages/backend/src/services/note/delete.ts @@ -1,4 +1,4 @@ -import { Brackets, FindOptionsWhere, In, IsNull, Not } from 'typeorm'; +import { FindOptionsWhere, In, IsNull, Not } from 'typeorm'; import { publishNoteStream } from '@/services/stream.js'; import renderDelete from '@/remote/activitypub/renderer/delete.js'; import renderAnnounce from '@/remote/activitypub/renderer/announce.js'; @@ -106,7 +106,7 @@ async function findCascadingNotes(note: Note): Promise { await Promise.all(replies.map(reply => { // only add unique notes - if (cascadingNotes.find((x) => x.id == reply.id) != null) return; + if (cascadingNotes.find((x) => x.id === reply.id) != null) return; cascadingNotes.push(reply); return recursive(reply.id);