From 453e83ea5d81d203ba34bc43cd5c2c750ba40568 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Aug 2019 11:53:26 +0200 Subject: Stronger model typings --- server/lib/avatar.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'server/lib/avatar.ts') diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index 1b38e6cb5..9005b3e22 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts @@ -3,8 +3,6 @@ import { sendUpdateActor } from './activitypub/send' import { AVATARS_SIZE, LRU_CACHE, QUEUE_CONCURRENCY } from '../initializers/constants' import { updateActorAvatarInstance } from './activitypub' import { processImage } from '../helpers/image-utils' -import { AccountModel } from '../models/account/account' -import { VideoChannelModel } from '../models/video/video-channel' import { extname, join } from 'path' import { retryTransactionWrapper } from '../helpers/database-utils' import * as uuidv4 from 'uuid/v4' @@ -13,8 +11,12 @@ import { sequelizeTypescript } from '../initializers/database' import * as LRUCache from 'lru-cache' import { queue } from 'async' import { downloadImage } from '../helpers/requests' +import { MAccountActorDefault, MChannelActorDefault } from '../typings/models' -async function updateActorAvatarFile (avatarPhysicalFile: Express.Multer.File, accountOrChannel: AccountModel | VideoChannelModel) { +async function updateActorAvatarFile ( + avatarPhysicalFile: Express.Multer.File, + accountOrChannel: MAccountActorDefault | MChannelActorDefault +) { const extension = extname(avatarPhysicalFile.filename) const avatarName = uuidv4() + extension const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName) -- cgit v1.2.3 From 0283eaac2a8e73006c66df3cf5bb9012e37450e5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Aug 2019 13:52:49 +0200 Subject: Cleanup model types --- server/lib/avatar.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/lib/avatar.ts') diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index 9005b3e22..ad4cdd3ab 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts @@ -11,11 +11,11 @@ import { sequelizeTypescript } from '../initializers/database' import * as LRUCache from 'lru-cache' import { queue } from 'async' import { downloadImage } from '../helpers/requests' -import { MAccountActorDefault, MChannelActorDefault } from '../typings/models' +import { MAccountDefault, MChannelDefault } from '../typings/models' async function updateActorAvatarFile ( avatarPhysicalFile: Express.Multer.File, - accountOrChannel: MAccountActorDefault | MChannelActorDefault + accountOrChannel: MAccountDefault | MChannelDefault ) { const extension = extname(avatarPhysicalFile.filename) const avatarName = uuidv4() + extension -- cgit v1.2.3