From b93d390af899efdd296c9aba3a59369b92955a04 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 4 Dec 2022 12:53:55 -0800 Subject: [PATCH] cleo ide moment --- .../backend/src/models/repositories/user.ts | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 47ab1fc9e..023ec7eb0 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -1,17 +1,18 @@ -import {In, Not} from 'typeorm'; +import { URL } from 'url'; +import { In, Not } from 'typeorm'; import Ajv from 'ajv'; -import {ILocalUser, IRemoteUser, User} from '@/models/entities/user.js'; +import type { ILocalUser, IRemoteUser } from '@/models/entities/user.js'; +import { User } from '@/models/entities/user.js'; import config from '@/config/index.js'; -import {Packed} from '@/misc/schema.js'; -import {awaitAll, Promiseable} from '@/prelude/await-all.js'; -import {populateEmojis} from '@/misc/populate-emojis.js'; -import {getAntennas} from '@/misc/antenna-cache.js'; -import {USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD} from '@/const.js'; -import {Cache} from '@/misc/cache.js'; -import {db} from '@/db/postgre.js'; -import {Instance} from '../entities/instance.js'; -import {resolveUser} from "@/remote/resolve-user"; -import {URL} from "url"; +import type { Packed } from '@/misc/schema.js'; +import type { Promiseable } from '@/prelude/await-all.js'; +import { awaitAll } from '@/prelude/await-all.js'; +import { populateEmojis } from '@/misc/populate-emojis.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; +import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js'; +import { Cache } from '@/misc/cache.js'; +import { db } from '@/db/postgre.js'; +import { resolveUser } from '@/remote/resolve-user.js'; import { AnnouncementReads, Announcements, @@ -31,14 +32,15 @@ import { UserGroupJoinings, UserNotePinings, UserProfiles, - UserSecurityKeys + UserSecurityKeys, } from '../index.js'; +import type { Instance } from '../entities/instance.js'; const userInstanceCache = new Cache(1000 * 60 * 60 * 3); type IsUserDetailed = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>; type IsMeAndIsUserDetailed = - Detailed extends true ? + Detailed extends true ? ExpectsMe extends true ? Packed<'MeDetailed'> : ExpectsMe extends false ? Packed<'UserDetailedNotMe'> : Packed<'UserDetailed'> : @@ -185,10 +187,10 @@ export const UserRepository = db.getRepository(User).extend({ return await resolveUser(id, null); } - let url = new URL(uri); + const url = new URL(uri); let userTag = url.pathname; - if (userTag.startsWith("@")) { + if (userTag.startsWith('@')) { userTag = userTag.substring(1); }