From 7458550f7a547f5e278f6d0444cd8bc1b1d13588 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 1 Apr 2024 18:26:15 +0200 Subject: [PATCH] server: fix some TS warnings --- packages/backend/src/queue/processors/deliver.ts | 3 --- packages/backend/src/services/note/side-effects.ts | 10 ++++++---- packages/backend/src/services/user-cache.ts | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index 910ee8613..2795b7d15 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -2,7 +2,6 @@ import { URL } from 'node:url'; import Bull from 'bull'; import { request } from '@/remote/activitypub/request.js'; import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc.js'; -import Logger from '@/services/logger.js'; import { Instances } from '@/models/index.js'; import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; import { toPuny } from '@/misc/convert-host.js'; @@ -11,8 +10,6 @@ import { getUserKeypair } from '@/misc/keypair-store.js'; import { shouldSkipInstance } from '@/misc/skipped-instances.js'; import { DeliverJobData } from '@/queue/types.js'; -const logger = new Logger('deliver'); - export default async (job: Bull.Job) => { const { host } = new URL(job.data.to); const puny = toPuny(host); diff --git a/packages/backend/src/services/note/side-effects.ts b/packages/backend/src/services/note/side-effects.ts index e5e34807d..86f224d6b 100644 --- a/packages/backend/src/services/note/side-effects.ts +++ b/packages/backend/src/services/note/side-effects.ts @@ -193,13 +193,15 @@ export async function sideEffects(user: User, note: Note, silent = false, create } // Word mute - mutedWordsCache.fetch('').then(us => { - for (const u of us) { - checkWordMute(note, { id: u.userId }, u.mutedWords).then(shouldMute => { + mutedWordsCache.fetch('').then(users => { + if (users == null) return; + + for (const user of users) { + checkWordMute(note, { id: user.userId }, user.mutedWords).then(shouldMute => { if (shouldMute) { MutedNotes.insert({ id: genId(), - userId: u.userId, + userId: user.userId, noteId: note.id, reason: 'word', }); diff --git a/packages/backend/src/services/user-cache.ts b/packages/backend/src/services/user-cache.ts index ed5599eae..1d6981400 100644 --- a/packages/backend/src/services/user-cache.ts +++ b/packages/backend/src/services/user-cache.ts @@ -1,5 +1,6 @@ import { IsNull } from 'typeorm'; import { ILocalUser, User } from '@/models/entities/user.js'; +import { UserPublickey } from '@/models/entities/user-publickey.js'; import { Users, UserPublickeys } from '@/models/index.js'; import { Cache } from '@/misc/cache.js'; import { subscriber } from '@/db/redis.js';