]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/abuse/abuse.ts
Update translations
[github/Chocobozzz/PeerTube.git] / server / models / abuse / abuse.ts
index 2a407c3d264bc4669bd3ba7283c8e2d5c19f13ce..de249d21144454a6a81bd8062f9ea627eb525f20 100644 (file)
@@ -1,6 +1,5 @@
-import * as Bluebird from 'bluebird'
 import { invert } from 'lodash'
-import { literal, Op, QueryTypes, WhereOptions } from 'sequelize'
+import { literal, Op, QueryTypes } from 'sequelize'
 import {
   AllowNull,
   BelongsTo,
@@ -188,7 +187,7 @@ export enum ScopeNames {
     }
   ]
 })
-export class AbuseModel extends Model<AbuseModel> {
+export class AbuseModel extends Model {
 
   @AllowNull(false)
   @Default(null)
@@ -265,33 +264,7 @@ export class AbuseModel extends Model<AbuseModel> {
   })
   VideoAbuse: VideoAbuseModel
 
-  // FIXME: deprecated in 2.3. Remove these validators
-  static loadByIdAndVideoId (id: number, videoId?: number, uuid?: string): Bluebird<MAbuseReporter> {
-    const videoWhere: WhereOptions = {}
-
-    if (videoId) videoWhere.videoId = videoId
-    if (uuid) videoWhere.deletedVideo = { uuid }
-
-    const query = {
-      include: [
-        {
-          model: VideoAbuseModel,
-          required: true,
-          where: videoWhere
-        },
-        {
-          model: AccountModel,
-          as: 'ReporterAccount'
-        }
-      ],
-      where: {
-        id
-      }
-    }
-    return AbuseModel.findOne(query)
-  }
-
-  static loadByIdWithReporter (id: number): Bluebird<MAbuseReporter> {
+  static loadByIdWithReporter (id: number): Promise<MAbuseReporter> {
     const query = {
       where: {
         id
@@ -307,7 +280,7 @@ export class AbuseModel extends Model<AbuseModel> {
     return AbuseModel.findOne(query)
   }
 
-  static loadFull (id: number): Bluebird<MAbuseFull> {
+  static loadFull (id: number): Promise<MAbuseFull> {
     const query = {
       where: {
         id
@@ -561,13 +534,7 @@ export class AbuseModel extends Model<AbuseModel> {
         : null,
 
       countReportsForReporter: (countReportsForReporter || 0),
-      countReportsForReportee: (countReportsForReportee || 0),
-
-      // FIXME: deprecated in 2.3, remove this
-      startAt: null,
-      endAt: null,
-      count: countReportsForVideo || 0,
-      nth: nthReportForVideo || 0
+      countReportsForReportee: (countReportsForReportee || 0)
     })
   }