]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/actor/actor.ts
Update changelog
[github/Chocobozzz/PeerTube.git] / server / models / actor / actor.ts
index 65c53f8f8a01f49decd5ff0b5ae855395da75388..c12dcf63408baade6dc126da947f62b06d6f1d3f 100644 (file)
@@ -1,5 +1,4 @@
 import { values } from 'lodash'
-import { extname } from 'path'
 import { literal, Op, Transaction } from 'sequelize'
 import {
   AllowNull,
@@ -18,7 +17,8 @@ import {
   UpdatedAt
 } from 'sequelize-typescript'
 import { ModelCache } from '@server/models/model-cache'
-import { AttributesOnly } from '@shared/core-utils'
+import { getLowercaseExtension } from '@shared/core-utils'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { ActivityIconObject, ActivityPubActorType } from '../../../shared/models/activitypub'
 import { ActorImage } from '../../../shared/models/actors/actor-image.model'
 import { activityPubContextify } from '../../helpers/activitypub'
@@ -496,7 +496,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
     }, { where, transaction })
   }
 
-  static loadAccountActorByVideoId (videoId: number): Promise<MActor> {
+  static loadAccountActorByVideoId (videoId: number, transaction: Transaction): Promise<MActor> {
     const query = {
       include: [
         {
@@ -520,7 +520,8 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
             }
           ]
         }
-      ]
+      ],
+      transaction
     }
 
     return ActorModel.unscoped().findOne(query)
@@ -567,7 +568,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
     let image: ActivityIconObject
 
     if (this.avatarId) {
-      const extension = extname(this.Avatar.filename)
+      const extension = getLowercaseExtension(this.Avatar.filename)
 
       icon = {
         type: 'Image',
@@ -580,7 +581,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
 
     if (this.bannerId) {
       const banner = (this as MActorAPChannel).Banner
-      const extension = extname(banner.filename)
+      const extension = getLowercaseExtension(banner.filename)
 
       image = {
         type: 'Image',