]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/account-video-rate.ts
Cleaner warning of IP address leaking on embedded videos (#2034)
[github/Chocobozzz/PeerTube.git] / server / models / account / account-video-rate.ts
index d5c214ecbc69b1a9e82395404b88b5c680642aab..4bd8114cf6e2a718a781b89a25fd8b4d42d64bc6 100644 (file)
@@ -6,7 +6,7 @@ import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constan
 import { VideoModel } from '../video/video'
 import { AccountModel } from './account'
 import { ActorModel } from '../activitypub/actor'
-import { getSort, throwIfNotValid } from '../utils'
+import { buildLocalAccountIdsIn, getSort, throwIfNotValid } from '../utils'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
 import { AccountVideoRate } from '../../../shared'
 import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel'
@@ -219,25 +219,11 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
             [Op.lt]: beforeUpdatedAt
           },
           videoId,
-          type
-        },
-        include: [
-          {
-            model: AccountModel.unscoped(),
-            required: true,
-            include: [
-              {
-                model: ActorModel.unscoped(),
-                required: true,
-                where: {
-                  serverId: {
-                    [Op.ne]: null
-                  }
-                }
-              }
-            ]
+          type,
+          accountId: {
+            [Op.notIn]: buildLocalAccountIdsIn()
           }
-        ],
+        },
         transaction: t
       }