]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/avatar/avatar.ts
Update server dependencies
[github/Chocobozzz/PeerTube.git] / server / models / avatar / avatar.ts
index 7a370bcd30ec1e55a61a2756194958d9f32c14e4..950e4b181464626a68b8058e8b4f28a9d7db94ee 100644 (file)
@@ -7,6 +7,7 @@ import { remove } from 'fs-extra'
 import { CONFIG } from '../../initializers/config'
 import { throwIfNotValid } from '../utils'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
+import { MAvatarFormattable } from '@server/typings/models'
 
 @Table({
   tableName: 'avatar',
@@ -24,7 +25,7 @@ export class AvatarModel extends Model<AvatarModel> {
   filename: string
 
   @AllowNull(true)
-  @Is('AvatarFileUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'fileUrl'))
+  @Is('AvatarFileUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'fileUrl', true))
   @Column
   fileUrl: string
 
@@ -57,7 +58,7 @@ export class AvatarModel extends Model<AvatarModel> {
     return AvatarModel.findOne(query)
   }
 
-  toFormattedJSON (): Avatar {
+  toFormattedJSON (this: MAvatarFormattable): Avatar {
     return {
       path: this.getStaticPath(),
       createdAt: this.createdAt,