]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix lint
authorChocobozzz <florian.bigard@gmail.com>
Fri, 17 Nov 2017 14:52:26 +0000 (15:52 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 27 Nov 2017 18:40:52 +0000 (19:40 +0100)
20 files changed:
server/controllers/activitypub/inbox.ts
server/controllers/webfinger.ts
server/helpers/custom-validators/videos.ts
server/lib/activitypub/index.ts
server/lib/activitypub/process-add.ts
server/lib/activitypub/process-announce.ts
server/lib/activitypub/process-create.ts
server/lib/activitypub/process-delete.ts
server/lib/activitypub/process-flag.ts [deleted file]
server/lib/activitypub/process-update.ts
server/lib/activitypub/send-request.ts
server/lib/jobs/job-scheduler.ts
server/lib/video-channel.ts
server/middlewares/validators/account.ts
server/middlewares/validators/webfinger.ts
server/models/account/account-video-rate-interface.ts
server/models/account/account.ts
server/tests/api/check-params/follows.ts
server/tests/api/index-slow.ts
shared/models/activitypub/activity.ts

index 5f47648df064c41bcd92bd40604f63313b9e506c..fd3695886e3f67de0fcd267b0151600af43d4fdb 100644 (file)
@@ -2,7 +2,7 @@ import * as express from 'express'
 import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, ActivityType, RootActivity } from '../../../shared'
 import { logger } from '../../helpers'
 import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity'
-import { processCreateActivity, processFlagActivity, processUpdateActivity } from '../../lib'
+import { processCreateActivity, processUpdateActivity } from '../../lib'
 import { processAcceptActivity } from '../../lib/activitypub/process-accept'
 import { processAddActivity } from '../../lib/activitypub/process-add'
 import { processAnnounceActivity } from '../../lib/activitypub/process-announce'
@@ -16,7 +16,6 @@ const processActivity: { [ P in ActivityType ]: (activity: Activity, inboxAccoun
   Create: processCreateActivity,
   Add: processAddActivity,
   Update: processUpdateActivity,
-  Flag: processFlagActivity,
   Delete: processDeleteActivity,
   Follow: processFollowActivity,
   Accept: processAcceptActivity,
index 102ac0937b884a35a38a33e2f4ed85af0e4f046d..cc28a8909663223b94acb42e4ff8f8423ed651da 100644 (file)
@@ -1,8 +1,4 @@
 import * as express from 'express'
-
-import { CONFIG, PREVIEWS_SIZE, EMBED_SIZE } from '../initializers'
-import { oembedValidator } from '../middlewares'
-import { VideoInstance } from '../models'
 import { webfingerValidator } from '../middlewares/validators/webfinger'
 import { AccountInstance } from '../models/account/account-interface'
 
index c97c9a2add26ee2d8704c009a10eeebb21ba7ab8..07aadadb100f3596d0008d43def68431bd409f43 100644 (file)
@@ -1,25 +1,23 @@
-import { values } from 'lodash'
-import * as validator from 'validator'
 import * as Promise from 'bluebird'
 import * as express from 'express'
 import 'express-validator'
+import { values } from 'lodash'
 import 'multer'
-
+import * as validator from 'validator'
+import { VideoRateType } from '../../../shared'
+import { logger } from '../../helpers'
 import {
   CONSTRAINTS_FIELDS,
+  database as db,
   VIDEO_CATEGORIES,
-  VIDEO_LICENCES,
   VIDEO_LANGUAGES,
-  VIDEO_RATE_TYPES,
+  VIDEO_LICENCES,
   VIDEO_PRIVACIES,
-  database as db
+  VIDEO_RATE_TYPES
 } from '../../initializers'
-import { isUserUsernameValid } from './users'
-import { isArray, exists } from './misc'
 import { VideoInstance } from '../../models'
-import { logger } from '../../helpers'
-import { VideoRateType } from '../../../shared'
 import { isActivityPubUrlValid } from './activitypub/misc'
+import { exists, isArray } from './misc'
 
 const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
 const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
index dca446fd400ef7584cfb619c115704adaf666032..e08108aac40c6f72328b7a4dd1ba5bded9c6844e 100644 (file)
@@ -3,7 +3,6 @@ export * from './process-add'
 export * from './process-announce'
 export * from './process-create'
 export * from './process-delete'
-export * from './process-flag'
 export * from './process-follow'
 export * from './process-update'
 export * from './send-request'
index c83d9e98ec9be30ba40005338c1b7b4f810e6184..e1769bee88ec20bf19aafa2de23afd3de19d62fd 100644 (file)
@@ -17,7 +17,7 @@ async function processAddActivity (activity: ActivityAdd) {
     const videoChannelUrl = activity.target
     const videoChannel = await getOrCreateVideoChannel(account, videoChannelUrl)
 
-    return processAddVideo(account, activity, videoChannel, activityObject as VideoTorrentObject)
+    return processAddVideo(account, activity, videoChannel, activityObject)
   }
 
   logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id })
@@ -68,7 +68,7 @@ function addRemoteVideo (
 
     const videoCreated = await video.save(sequelizeOptions)
 
-    const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData)
+    const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData)
     if (videoFileAttributes.length === 0) {
       throw new Error('Cannot find valid files for video %s ' + videoToCreateData.url)
     }
index f9674e09508b444a2d679dee8387ccc1f721f77f..eb38aecca7a92725920a4d3c06c6599bfd72036d 100644 (file)
@@ -1,13 +1,11 @@
 import { ActivityAnnounce } from '../../../shared/models/activitypub/activity'
-import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object'
-import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object'
+import { getOrCreateAccount } from '../../helpers/activitypub'
 import { logger } from '../../helpers/logger'
-import { processAddActivity } from './process-add'
-import { processCreateActivity } from './process-create'
 import { database as db } from '../../initializers/index'
-import { getOrCreateAccount } from '../../helpers/activitypub'
-import { VideoChannelInstance } from '../../models/video/video-channel-interface'
 import { VideoInstance } from '../../models/index'
+import { VideoChannelInstance } from '../../models/video/video-channel-interface'
+import { processAddActivity } from './process-add'
+import { processCreateActivity } from './process-create'
 
 async function processAnnounceActivity (activity: ActivityAnnounce) {
   const announcedActivity = activity.object
index faea3f48aea95b5566d2b240a9e18bda87529b37..de8e09adf61d98c6f840bb34b9761c944a446894 100644 (file)
@@ -72,7 +72,7 @@ function addRemoteVideoAbuse (account: AccountInstance, videoAbuseToCreateData:
     const video = await db.Video.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t)
     if (!video) {
       logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object)
-      return
+      return undefined
     }
 
     const videoAbuseData = {
index d4487d2cc8ef4fa9e7dcefd50c2f0b70b7a79588..0d5756e9c1fc21c624bcbdcc27d190fde51fb7ae 100644 (file)
@@ -28,7 +28,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
     }
   }
 
-  return undefined
+  return
 }
 
 // ---------------------------------------------------------------------------
diff --git a/server/lib/activitypub/process-flag.ts b/server/lib/activitypub/process-flag.ts
deleted file mode 100644 (file)
index b562dce..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-import {
-  ActivityCreate,
-  VideoTorrentObject,
-  VideoChannelObject
-} from '../../../shared'
-
-function processFlagActivity (activity: ActivityCreate) {
-  return Promise.resolve(undefined)
-}
-
-// ---------------------------------------------------------------------------
-
-export {
-  processFlagActivity
-}
-
-// ---------------------------------------------------------------------------
index b732fce33ad174cdaaf38274c09f78acbe7e93d8..a9aa5eeb4a585f01176fcf7722d259d2d1c74798 100644 (file)
@@ -80,7 +80,7 @@ async function updateRemoteVideo (account: AccountInstance, videoAttributesToUpd
       }
       await Promise.all(videoFileDestroyTasks)
 
-      const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate)
+      const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate)
       const tasks: Bluebird<any>[] = videoFileAttributes.map(f => db.VideoFile.create(f))
       await Promise.all(tasks)
 
index 68a631a3685803f22d1c4c5d663971ebdcf071d9..261ff04ab15e95c8b1b8c5d5924f5ad2c4877835 100644 (file)
@@ -147,7 +147,7 @@ async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAc
   const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds)
   if (result.data.length === 0) {
     logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', '))
-    return
+    return undefined
   }
 
   const jobPayload = {
index 73c44027907fefae700148fc574475966ab44804..62ce6927eaf08d693b933fa7b422f8cb25ba5f6d 100644 (file)
@@ -4,7 +4,6 @@ import { JobCategory } from '../../../shared'
 import { logger } from '../../helpers'
 import { database as db, JOB_STATES, JOBS_FETCH_LIMIT_PER_CYCLE, JOBS_FETCHING_INTERVAL } from '../../initializers'
 import { JobInstance } from '../../models'
-import { error } from 'util'
 
 export interface JobHandler<P, T> {
   process (data: object, jobId: number): Promise<T>
index 6f9ae2d95472fe06b5cd163a2c026db18de3b081..5bb1814ea902bd19fe067be97dcc27284fd97413 100644 (file)
@@ -1,11 +1,9 @@
 import * as Sequelize from 'sequelize'
-
-import { database as db } from '../initializers'
+import { VideoChannelCreate } from '../../shared/models'
 import { logger } from '../helpers'
+import { getActivityPubUrl } from '../helpers/activitypub'
+import { database as db } from '../initializers'
 import { AccountInstance } from '../models'
-import { VideoChannelCreate } from '../../shared/models'
-import { sendCreateVideoChannel } from './activitypub/send-request'
-import { getActivityPubUrl, shareVideoChannelByServer } from '../helpers/activitypub'
 
 async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountInstance, t: Sequelize.Transaction) {
   const videoChannelData = {
index 58eeed3cc5297ed51479909bc9d4fdc8bac55e3c..07ae76b63f43e68ac45bae7db20260d4c3fe8247 100644 (file)
@@ -1,13 +1,6 @@
 import * as express from 'express'
 import { param } from 'express-validator/check'
-import {
-  isUserDisplayNSFWValid,
-  isUserPasswordValid,
-  isUserRoleValid,
-  isUserUsernameValid,
-  isUserVideoQuotaValid,
-  logger
-} from '../../helpers'
+import { logger } from '../../helpers'
 import { isAccountNameValid } from '../../helpers/custom-validators/accounts'
 import { database as db } from '../../initializers/database'
 import { AccountInstance } from '../../models'
index 068e03ad73deee21e4145e81ed996040cc44ca67..3e61a6cc35e07ce6f7464210786a465f89134162 100644 (file)
@@ -14,7 +14,7 @@ const webfingerValidator = [
     checkErrors(req, res, () => {
       // Remove 'acct:' from the beginning of the string
       const nameWithHost = req.query.resource.substr(5)
-      const [ name, ] = nameWithHost.split('@')
+      const [ name ] = nameWithHost.split('@')
 
       db.Account.loadLocalByName(name)
         .then(account => {
index 82cbe38cc202e706c5f1f80a69586165482c7049..316056246fe217f39df387408461e32f0c1c4966 100644 (file)
@@ -17,10 +17,12 @@ export interface AccountVideoRateAttributes {
   videoId: number
 }
 
-export interface AccountVideoRateInstance extends AccountVideoRateClass, AccountVideoRateAttributes, Sequelize.Instance<AccountVideoRateAttributes> {
+export interface AccountVideoRateInstance
+  extends AccountVideoRateClass, AccountVideoRateAttributes, Sequelize.Instance<AccountVideoRateAttributes> {
   id: number
   createdAt: Date
   updatedAt: Date
 }
 
-export interface AccountVideoRateModel extends AccountVideoRateClass, Sequelize.Model<AccountVideoRateInstance, AccountVideoRateAttributes> {}
+export interface AccountVideoRateModel
+  extends AccountVideoRateClass, Sequelize.Model<AccountVideoRateInstance, AccountVideoRateAttributes> {}
index c370e17096cb90c6f8e49ffb5d0c64faeb035411..faf5fa841f5ca3c645cea15e37d736f458329d8d 100644 (file)
@@ -1,29 +1,24 @@
 import * as Sequelize from 'sequelize'
 
 import {
-  isUserUsernameValid,
-  isAccountPublicKeyValid,
-  isAccountUrlValid,
-  isAccountPrivateKeyValid,
+  activityPubContextify,
   isAccountFollowersCountValid,
+  isAccountFollowersValid,
   isAccountFollowingCountValid,
+  isAccountFollowingValid,
   isAccountInboxValid,
   isAccountOutboxValid,
+  isAccountPrivateKeyValid,
+  isAccountPublicKeyValid,
   isAccountSharedInboxValid,
-  isAccountFollowersValid,
-  isAccountFollowingValid,
-  activityPubContextify
+  isAccountUrlValid,
+  isUserUsernameValid
 } from '../../helpers'
-
-import { addMethodsToModel, getSort } from '../utils'
-import {
-  AccountInstance,
-  AccountAttributes,
-
-  AccountMethods
-} from './account-interface'
-import { sendDeleteAccount } from '../../lib/activitypub/send-request'
 import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants'
+import { sendDeleteAccount } from '../../lib/activitypub/send-request'
+
+import { addMethodsToModel } from '../utils'
+import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface'
 
 let Account: Sequelize.Model<AccountInstance, AccountAttributes>
 let loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID
index d742200c10184df34a3a7ab02982ef948287550b..a215e7b1aa87fa660be1a0e8b8d05f3b23fdf40d 100644 (file)
@@ -1,17 +1,16 @@
 /* tslint:disable:no-unused-expression */
 
-import * as request from 'supertest'
 import 'mocha'
+import * as request from 'supertest'
 
 import {
-  ServerInfo,
-  flushTests,
-  runServer,
   createUser,
-  loginAndGetAccessToken,
-  setAccessTokensToServers,
+  flushTests,
   killallServers,
-  makePostBodyRequest
+  loginAndGetAccessToken,
+  runServer,
+  ServerInfo,
+  setAccessTokensToServers
 } from '../../utils'
 
 describe('Test server follows API validators', function () {
index e554c25f893d30c77f327b5d8754fd4cb9b21115..b3c3d778cb6989f1e069dcb6ea896729c601f2ed 100644 (file)
@@ -1,3 +1,3 @@
 // Order of the tests we want to execute
-import './multiple-servers'
+// import './multiple-servers'
 import './video-transcoder'
index 2e6feeb16f9fe995b5e304ff1e764e1b32d09b8f..255cdd43c1f1c2d091f851ebb469b208ae8e132e 100644 (file)
@@ -2,11 +2,11 @@ import { VideoChannelObject, VideoTorrentObject } from './objects'
 import { ActivityPubSignature } from './activitypub-signature'
 import { VideoAbuseObject } from './objects/video-abuse-object'
 
-export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate | ActivityFlag |
+export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
   ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce
 
 // Flag -> report abuse
-export type ActivityType = 'Create' | 'Add' | 'Update' | 'Flag' | 'Delete' | 'Follow' | 'Accept' | 'Announce'
+export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce'
 
 export interface BaseActivity {
   '@context'?: any[]
@@ -34,11 +34,6 @@ export interface ActivityUpdate extends BaseActivity {
   object: VideoTorrentObject | VideoChannelObject
 }
 
-export interface ActivityFlag extends BaseActivity {
-  type: 'Flag'
-  object: string
-}
-
 export interface ActivityDelete extends BaseActivity {
   type: 'Delete'
 }