From 41a277fccbef07d79b8d95e7576695a0da48ed77 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Tue, 14 Nov 2023 19:49:15 +0900 Subject: [PATCH] lint --- .../src/core/AvatarDecorationService.ts | 28 +++++++++---------- .../activitypub/models/ApPersonService.ts | 2 +- .../backend/src/models/AvatarDecoration.ts | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/backend/src/core/AvatarDecorationService.ts b/packages/backend/src/core/AvatarDecorationService.ts index 0072121a11..d50bcf9480 100644 --- a/packages/backend/src/core/AvatarDecorationService.ts +++ b/packages/backend/src/core/AvatarDecorationService.ts @@ -5,6 +5,7 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import * as Redis from 'ioredis'; +import { IsNull } from 'typeorm'; import type { AvatarDecorationsRepository, InstancesRepository, UsersRepository, MiAvatarDecoration, MiUser } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; @@ -13,10 +14,9 @@ import { bindThis } from '@/decorators.js'; import { MemorySingleCache } from '@/misc/cache.js'; import type { GlobalEvents } from '@/core/GlobalEventService.js'; import { ModerationLogService } from '@/core/ModerationLogService.js'; -import { HttpRequestService } from "@/core/HttpRequestService.js"; +import { HttpRequestService } from '@/core/HttpRequestService.js'; import { appendQuery, query } from '@/misc/prelude/url.js'; import type { Config } from '@/config.js'; -import {IsNull} from "typeorm"; @Injectable() export class AvatarDecorationService implements OnApplicationShutdown { @@ -112,10 +112,10 @@ export class AvatarDecorationService implements OnApplicationShutdown { private getProxiedUrl(url: string, mode?: 'static' | 'avatar'): string { return appendQuery( `${this.config.mediaProxy}/${mode ?? 'image'}.webp`, - query({ - url, - ...(mode ? { [mode]: '1' } : {}), - }), + query({ + url, + ...(mode ? { [mode]: '1' } : {}), + }), ); } @@ -132,8 +132,8 @@ export class AvatarDecorationService implements OnApplicationShutdown { const res = await this.httpRequestService.send(showUserApiUrl, { method: 'POST', - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ "username": user.username }), + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ 'username': user.username }), }); const userData: any = await res.json(); @@ -142,16 +142,16 @@ export class AvatarDecorationService implements OnApplicationShutdown { if (!avatarDecorations) { const updates = {} as Partial; updates.avatarDecorations = []; - await this.usersRepository.update({id: user.id}, updates); + await this.usersRepository.update({ id: user.id }, updates); return; } const avatarDecorationId = avatarDecorations.id; - const instanceHost = instance?.host; + const instanceHost = instance.host; const decorationApiUrl = `https://${instanceHost}/api/get-avatar-decorations`; const allRes = await this.httpRequestService.send(decorationApiUrl, { method: 'POST', - headers: {"Content-Type": "application/json"}, + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({}), }); const allDecorations: any = await allRes.json(); @@ -166,7 +166,7 @@ export class AvatarDecorationService implements OnApplicationShutdown { } const existingDecoration = await this.avatarDecorationsRepository.findOneBy({ host: userHost, - remoteId: avatarDecorationId + remoteId: avatarDecorationId, }); const decorationData = { name: name, @@ -182,7 +182,7 @@ export class AvatarDecorationService implements OnApplicationShutdown { } const findDecoration = await this.avatarDecorationsRepository.findOneBy({ host: userHost, - remoteId: avatarDecorationId + remoteId: avatarDecorationId, }); const updates = {} as Partial; updates.avatarDecorations = [{ @@ -190,7 +190,7 @@ export class AvatarDecorationService implements OnApplicationShutdown { angle: avatarDecorations.angle ?? 0, flipH: avatarDecorations.flipH ?? false, }]; - await this.usersRepository.update({id: user.id}, updates); + await this.usersRepository.update({ id: user.id }, updates); } @bindThis diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index f7739db933..a80110c57b 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -38,6 +38,7 @@ import { MetaService } from '@/core/MetaService.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; import type { AccountMoveService } from '@/core/AccountMoveService.js'; import { checkHttps } from '@/misc/check-https.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; import { getApId, getApType, getOneApHrefNullable, isActor, isCollection, isCollectionOrOrderedCollection, isPropertyValue } from '../type.js'; import { extractApHashtags } from './tag.js'; import type { OnModuleInit } from '@nestjs/common'; @@ -48,7 +49,6 @@ import type { ApLoggerService } from '../ApLoggerService.js'; // eslint-disable-next-line @typescript-eslint/consistent-type-imports import type { ApImageService } from './ApImageService.js'; import type { IActor, IObject } from '../type.js'; -import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; const nameLength = 128; const summaryLength = 2048; diff --git a/packages/backend/src/models/AvatarDecoration.ts b/packages/backend/src/models/AvatarDecoration.ts index 327857115a..5394cc3dea 100644 --- a/packages/backend/src/models/AvatarDecoration.ts +++ b/packages/backend/src/models/AvatarDecoration.ts @@ -43,7 +43,7 @@ export class MiAvatarDecoration { public remoteId: string; @Column('varchar', { - length: 128, nullable: true + length: 128, nullable: true, }) public host: string | null; }