From 56563d8dc478c3e7ccbe9f17d6bd549ad0ce480b Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 22 Nov 2024 13:09:58 +0000 Subject: [PATCH] fix lints --- packages/backend/src/core/UserWebhookService.ts | 2 +- packages/backend/src/core/WebhookTestService.ts | 4 ++++ packages/backend/src/core/activitypub/ApRequestService.ts | 1 - packages/backend/src/core/activitypub/models/ApNoteService.ts | 1 - packages/backend/src/server/ActivityPubServerService.ts | 2 +- packages/backend/src/server/api/endpoints/notes/show.ts | 3 ++- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/core/UserWebhookService.ts b/packages/backend/src/core/UserWebhookService.ts index 7117a3d7fa..911efdf768 100644 --- a/packages/backend/src/core/UserWebhookService.ts +++ b/packages/backend/src/core/UserWebhookService.ts @@ -14,7 +14,7 @@ import type { OnApplicationShutdown } from '@nestjs/common'; import type { Packed } from '@/misc/json-schema.js'; export type UserWebhookPayload = - T extends 'note' | 'reply' | 'renote' |'mention' ? { + T extends 'note' | 'reply' | 'renote' |'mention' | 'edited' ? { note: Packed<'Note'>, } : T extends 'follow' | 'unfollow' ? { diff --git a/packages/backend/src/core/WebhookTestService.ts b/packages/backend/src/core/WebhookTestService.ts index 746f289311..1530d91532 100644 --- a/packages/backend/src/core/WebhookTestService.ts +++ b/packages/backend/src/core/WebhookTestService.ts @@ -389,6 +389,10 @@ export class WebhookTestService { send('mention', { note: toPackedNote(dummyMention1) }); break; } + case 'edited': { + send('edited', { note: toPackedNote(dummyNote1) }); + break; + } case 'follow': { send('follow', { user: toPackedUserDetailedNotMe(dummyUser1) }); break; diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts index a5f96dfac1..8fb4981ed4 100644 --- a/packages/backend/src/core/activitypub/ApRequestService.ts +++ b/packages/backend/src/core/activitypub/ApRequestService.ts @@ -16,7 +16,6 @@ import { HttpRequestService } from '@/core/HttpRequestService.js'; import { LoggerService } from '@/core/LoggerService.js'; import { bindThis } from '@/decorators.js'; import type Logger from '@/logger.js'; -import type { IObject } from './type.js'; import { validateContentTypeSetAsActivityPub } from '@/core/activitypub/misc/validator.js'; import { assertActivityMatchesUrls } from '@/core/activitypub/misc/check-against-url.js'; import type { IObject } from './type.js'; diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts index 48538a7c26..51dd357cc5 100644 --- a/packages/backend/src/core/activitypub/models/ApNoteService.ts +++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts @@ -421,7 +421,6 @@ export class ApNoteService { const url = getOneApHrefNullable(note.url); - if (url != null) { if (!checkHttps(url)) { throw new Error('unexpected schema of note url: ' + url); diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index efbc8721b3..815bf278c7 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -814,7 +814,7 @@ export class ActivityPubServerService { }); fastify.get<{ Params: { acct: string; } }>('/@:acct', { constraints: { apOrHtml: 'ap' } }, async (request, reply) => { - if (await this.shouldRefuseGetRequest(request, reply, request.params.user)) return; + if (await this.shouldRefuseGetRequest(request, reply, request.params.acct)) return; vary(reply.raw, 'Accept'); diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index c189a708f2..a5bc3719cd 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -8,6 +8,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { DI } from '@/di-symbols.js'; import type { NotesRepository } from '@/models/_.js'; +import { QueryService } from '@/core/QueryService.js'; import { ApiError } from '../../error.js'; export const meta = { @@ -55,7 +56,7 @@ export default class extends Endpoint { // eslint- super(meta, paramDef, async (ps, me) => { const query = await this.notesRepository.createQueryBuilder('note') .where('note.id = :noteId', { noteId: ps.noteId }) - .innerJoinAndSelect('user'); + .innerJoinAndSelect('note.user', 'user'); this.queryService.generateVisibilityQuery(query, me); if (me) {