]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix SQL query
authorChocobozzz <me@florianbigard.com>
Fri, 12 May 2023 07:06:16 +0000 (09:06 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 12 May 2023 07:06:16 +0000 (09:06 +0200)
server/models/actor/actor-follow.ts
server/models/actor/actor.ts
server/models/video/video-channel.ts

index 0f199d20878440222c8e088eb8d6bc17723041f9..71ce9fa6fb2887d298cecd999ac6e2bfb6e9c692 100644 (file)
@@ -311,7 +311,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
         if (t.host) {
           return {
             [Op.and]: [
-              ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'),
+              ActorModel.wherePreferredUsername(t.name),
               { $host$: t.host }
             ]
           }
@@ -319,7 +319,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
 
         return {
           [Op.and]: [
-            ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'),
+            ActorModel.wherePreferredUsername(t.name),
             { $serverId$: null }
           ]
         }
index 1524e053385397c71fc0d07eeccaba4fcdb510e3..80a646c77f59e669119c61a8337a50d1534353a4 100644 (file)
@@ -381,7 +381,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
       const query = {
         where: {
           [Op.and]: [
-            this.wherePreferredUsername(preferredUsername),
+            this.wherePreferredUsername(preferredUsername, '"ActorModel"."preferredUsername"'),
             {
               serverId: null
             }
@@ -431,7 +431,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
 
   static loadByNameAndHost (preferredUsername: string, host: string): Promise<MActorFull> {
     const query = {
-      where: this.wherePreferredUsername(preferredUsername),
+      where: this.wherePreferredUsername(preferredUsername, '"ActorModel"."preferredUsername"'),
       include: [
         {
           model: ServerModel,
index 306bc6ade8074d73a26bc13b5bbe4bf0db2c0112..0fb52827e9a15b5192a89877d2318cc455628dc5 100644 (file)
@@ -702,7 +702,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
           required: true,
           where: {
             [Op.and]: [
-              ActorModel.wherePreferredUsername(name),
+              ActorModel.wherePreferredUsername(name, 'Actor.preferredUsername'),
               { serverId: null }
             ]
           },
@@ -728,7 +728,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
         {
           model: ActorModel,
           required: true,
-          where: ActorModel.wherePreferredUsername(name),
+          where: ActorModel.wherePreferredUsername(name, 'Actor.preferredUsername'),
           include: [
             {
               model: ServerModel,