Fix lint
This commit is contained in:
parent
d88c9eb9db
commit
a02b93ce75
|
@ -6,6 +6,7 @@ import { USER_ROLE_LABELS } from '@shared/core-utils/users'
|
||||||
import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
|
import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
|
// tslint:disable-next-line: directive-class-suffix
|
||||||
export abstract class UserEdit extends FormReactive implements OnInit {
|
export abstract class UserEdit extends FormReactive implements OnInit {
|
||||||
videoQuotaOptions: { value: string, label: string, disabled?: boolean }[] = []
|
videoQuotaOptions: { value: string, label: string, disabled?: boolean }[] = []
|
||||||
videoQuotaDailyOptions: { value: string, label: string, disabled?: boolean }[] = []
|
videoQuotaDailyOptions: { value: string, label: string, disabled?: boolean }[] = []
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Subject } from 'rxjs'
|
import { Subject } from 'rxjs'
|
||||||
import { debounceTime, flatMap } from 'rxjs/operators'
|
import { debounceTime, mergeMap } from 'rxjs/operators'
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnInit } from '@angular/core'
|
||||||
import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core'
|
import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core'
|
||||||
import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
|
import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
|
||||||
|
@ -95,7 +95,7 @@ export class MyAccountVideoPlaylistsComponent implements OnInit {
|
||||||
|
|
||||||
private loadVideoPlaylists (reset = false) {
|
private loadVideoPlaylists (reset = false) {
|
||||||
this.authService.userInformationLoaded
|
this.authService.userInformationLoaded
|
||||||
.pipe(flatMap(() => {
|
.pipe(mergeMap(() => {
|
||||||
return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
|
return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
|
||||||
}))
|
}))
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
|
|
|
@ -84,11 +84,11 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
|
||||||
channelId: this.firstStepChannelId
|
channelId: this.firstStepChannelId
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadingBar.start()
|
this.loadingBar.useRef().start()
|
||||||
|
|
||||||
this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate).subscribe(
|
this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate).subscribe(
|
||||||
res => {
|
res => {
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
this.firstStepDone.emit(res.video.name)
|
this.firstStepDone.emit(res.video.name)
|
||||||
this.isImportingVideo = false
|
this.isImportingVideo = false
|
||||||
this.hasImportedVideo = true
|
this.hasImportedVideo = true
|
||||||
|
@ -105,7 +105,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
|
||||||
},
|
},
|
||||||
|
|
||||||
err => {
|
err => {
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
this.isImportingVideo = false
|
this.isImportingVideo = false
|
||||||
this.firstStepError.emit()
|
this.firstStepError.emit()
|
||||||
this.notifier.error(err.message)
|
this.notifier.error(err.message)
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
|
||||||
channelId: this.firstStepChannelId
|
channelId: this.firstStepChannelId
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadingBar.start()
|
this.loadingBar.useRef().start()
|
||||||
|
|
||||||
this.videoImportService
|
this.videoImportService
|
||||||
.importVideoUrl(this.targetUrl, videoUpdate)
|
.importVideoUrl(this.targetUrl, videoUpdate)
|
||||||
|
@ -86,7 +86,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
|
||||||
)
|
)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
({ video, videoCaptions }) => {
|
({ video, videoCaptions }) => {
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
this.firstStepDone.emit(video.name)
|
this.firstStepDone.emit(video.name)
|
||||||
this.isImportingVideo = false
|
this.isImportingVideo = false
|
||||||
this.hasImportedVideo = true
|
this.hasImportedVideo = true
|
||||||
|
@ -115,7 +115,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
|
||||||
},
|
},
|
||||||
|
|
||||||
err => {
|
err => {
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
this.isImportingVideo = false
|
this.isImportingVideo = false
|
||||||
this.firstStepError.emit()
|
this.firstStepError.emit()
|
||||||
this.notifier.error(err.message)
|
this.notifier.error(err.message)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { catchError, switchMap, tap } from 'rxjs/operators'
|
import { catchError, switchMap, tap } from 'rxjs/operators'
|
||||||
import { EventEmitter, OnInit, Directive } from '@angular/core'
|
import { Directive, EventEmitter, OnInit } from '@angular/core'
|
||||||
import { AuthService, CanComponentDeactivateResult, Notifier, ServerService } from '@app/core'
|
import { AuthService, CanComponentDeactivateResult, Notifier, ServerService } from '@app/core'
|
||||||
import { populateAsyncUserVideoChannels } from '@app/helpers'
|
import { populateAsyncUserVideoChannels } from '@app/helpers'
|
||||||
import { FormReactive } from '@app/shared/shared-forms'
|
import { FormReactive } from '@app/shared/shared-forms'
|
||||||
|
@ -8,6 +8,7 @@ import { LoadingBarService } from '@ngx-loading-bar/core'
|
||||||
import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
|
import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
|
// tslint:disable-next-line: directive-class-suffix
|
||||||
export abstract class VideoSend extends FormReactive implements OnInit {
|
export abstract class VideoSend extends FormReactive implements OnInit {
|
||||||
userVideoChannels: { id: number, label: string, support: string }[] = []
|
userVideoChannels: { id: number, label: string, support: string }[] = []
|
||||||
videoPrivacies: VideoConstant<VideoPrivacy>[] = []
|
videoPrivacies: VideoConstant<VideoPrivacy>[] = []
|
||||||
|
@ -56,15 +57,15 @@ export abstract class VideoSend extends FormReactive implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updateVideoAndCaptions (video: VideoEdit) {
|
protected updateVideoAndCaptions (video: VideoEdit) {
|
||||||
this.loadingBar.start()
|
this.loadingBar.useRef().start()
|
||||||
|
|
||||||
return this.videoService.updateVideo(video)
|
return this.videoService.updateVideo(video)
|
||||||
.pipe(
|
.pipe(
|
||||||
// Then update captions
|
// Then update captions
|
||||||
switchMap(() => this.videoCaptionService.updateCaptions(video.id, this.videoCaptions)),
|
switchMap(() => this.videoCaptionService.updateCaptions(video.id, this.videoCaptions)),
|
||||||
tap(() => this.loadingBar.complete()),
|
tap(() => this.loadingBar.useRef().complete()),
|
||||||
catchError(err => {
|
catchError(err => {
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
@ -101,7 +101,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
|
||||||
|
|
||||||
this.video.patch(this.form.value)
|
this.video.patch(this.form.value)
|
||||||
|
|
||||||
this.loadingBar.start()
|
this.loadingBar.useRef().start()
|
||||||
this.isUpdatingVideo = true
|
this.isUpdatingVideo = true
|
||||||
|
|
||||||
// Update the video
|
// Update the video
|
||||||
|
@ -114,13 +114,13 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
|
||||||
() => {
|
() => {
|
||||||
this.updateDone = true
|
this.updateDone = true
|
||||||
this.isUpdatingVideo = false
|
this.isUpdatingVideo = false
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
this.notifier.success(this.i18n('Video updated.'))
|
this.notifier.success(this.i18n('Video updated.'))
|
||||||
this.router.navigate([ '/videos/watch', this.video.uuid ])
|
this.router.navigate([ '/videos/watch', this.video.uuid ])
|
||||||
},
|
},
|
||||||
|
|
||||||
err => {
|
err => {
|
||||||
this.loadingBar.complete()
|
this.loadingBar.useRef().complete()
|
||||||
this.isUpdatingVideo = false
|
this.isUpdatingVideo = false
|
||||||
this.notifier.error(err.message)
|
this.notifier.error(err.message)
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Observable, of } from 'rxjs'
|
import { Observable, of } from 'rxjs'
|
||||||
import { map } from 'rxjs/operators'
|
import { map } from 'rxjs/operators'
|
||||||
import { User } from '@app/core/users/user.model'
|
import { User } from '@app/core/users/user.model'
|
||||||
import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage'
|
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
||||||
import { hasUserRight } from '@shared/core-utils/users'
|
import { hasUserRight } from '@shared/core-utils/users'
|
||||||
import {
|
import {
|
||||||
MyUser as ServerMyUserModel,
|
MyUser as ServerMyUserModel,
|
||||||
|
@ -12,7 +12,7 @@ import {
|
||||||
UserRole,
|
UserRole,
|
||||||
UserVideoQuota
|
UserVideoQuota
|
||||||
} from '@shared/models'
|
} from '@shared/models'
|
||||||
import { TokenOptions, Tokens } from '../../../root-helpers/pure-auth-user.model'
|
import { TokenOptions, Tokens } from '@root-helpers/pure-auth-user.model'
|
||||||
|
|
||||||
export class AuthUser extends User implements ServerMyUserModel {
|
export class AuthUser extends User implements ServerMyUserModel {
|
||||||
tokens: Tokens
|
tokens: Tokens
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { AccountBlock } from './account-block.model'
|
||||||
import { BlocklistComponentType, BlocklistService } from './blocklist.service'
|
import { BlocklistComponentType, BlocklistService } from './blocklist.service'
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
|
// tslint:disable-next-line: directive-class-suffix
|
||||||
export class GenericAccountBlocklistComponent extends RestTable implements OnInit {
|
export class GenericAccountBlocklistComponent extends RestTable implements OnInit {
|
||||||
// @ts-ignore: "Abstract methods can only appear within an abstract class"
|
// @ts-ignore: "Abstract methods can only appear within an abstract class"
|
||||||
abstract mode: BlocklistComponentType
|
abstract mode: BlocklistComponentType
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import { SortMeta } from 'primeng/api'
|
import { SortMeta } from 'primeng/api'
|
||||||
import { OnInit, ViewChild, Directive } from '@angular/core'
|
import { Directive, OnInit, ViewChild } from '@angular/core'
|
||||||
import { BatchDomainsModalComponent } from '@app/shared/shared-moderation/batch-domains-modal.component'
|
|
||||||
import { Notifier, RestPagination, RestTable } from '@app/core'
|
import { Notifier, RestPagination, RestTable } from '@app/core'
|
||||||
|
import { BatchDomainsModalComponent } from '@app/shared/shared-moderation/batch-domains-modal.component'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { ServerBlock } from '@shared/models'
|
import { ServerBlock } from '@shared/models'
|
||||||
import { BlocklistComponentType, BlocklistService } from './blocklist.service'
|
import { BlocklistComponentType, BlocklistService } from './blocklist.service'
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
|
// tslint:disable-next-line: directive-class-suffix
|
||||||
export class GenericServerBlocklistComponent extends RestTable implements OnInit {
|
export class GenericServerBlocklistComponent extends RestTable implements OnInit {
|
||||||
@ViewChild('batchDomainsModal') batchDomainsModal: BatchDomainsModalComponent
|
@ViewChild('batchDomainsModal') batchDomainsModal: BatchDomainsModalComponent
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { fromEvent, Observable, Subject, Subscription } from 'rxjs'
|
import { fromEvent, Observable, Subject, Subscription } from 'rxjs'
|
||||||
import { debounceTime, switchMap, tap } from 'rxjs/operators'
|
import { debounceTime, switchMap, tap } from 'rxjs/operators'
|
||||||
import { OnDestroy, OnInit, Directive } from '@angular/core'
|
import { Directive, OnDestroy, OnInit } from '@angular/core'
|
||||||
import { ActivatedRoute, Router } from '@angular/router'
|
import { ActivatedRoute, Router } from '@angular/router'
|
||||||
import {
|
import {
|
||||||
AuthService,
|
AuthService,
|
||||||
|
@ -31,6 +31,7 @@ enum GroupDate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
|
// tslint:disable-next-line: directive-class-suffix
|
||||||
export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableForReuseHook {
|
export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableForReuseHook {
|
||||||
pagination: ComponentPaginationLight = {
|
pagination: ComponentPaginationLight = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { logger } from '../../helpers/logger'
|
||||||
import { areValidationErrors } from './utils'
|
import { areValidationErrors } from './utils'
|
||||||
import { isNpmPluginNameValid, isPluginNameValid, isPluginTypeValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
|
import { isNpmPluginNameValid, isPluginNameValid, isPluginTypeValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
|
||||||
import { PluginManager } from '../../lib/plugins/plugin-manager'
|
import { PluginManager } from '../../lib/plugins/plugin-manager'
|
||||||
import { isBooleanValid, isSafePath, toBooleanOrNull, exists } from '../../helpers/custom-validators/misc'
|
import { isBooleanValid, isSafePath, toBooleanOrNull, exists, toIntOrNull } from '../../helpers/custom-validators/misc'
|
||||||
import { PluginModel } from '../../models/server/plugin'
|
import { PluginModel } from '../../models/server/plugin'
|
||||||
import { InstallOrUpdatePlugin } from '../../../shared/models/plugins/install-plugin.model'
|
import { InstallOrUpdatePlugin } from '../../../shared/models/plugins/install-plugin.model'
|
||||||
import { PluginType } from '../../../shared/models/plugins/plugin.type'
|
import { PluginType } from '../../../shared/models/plugins/plugin.type'
|
||||||
|
@ -75,6 +75,7 @@ const pluginStaticDirectoryValidator = [
|
||||||
const listPluginsValidator = [
|
const listPluginsValidator = [
|
||||||
query('pluginType')
|
query('pluginType')
|
||||||
.optional()
|
.optional()
|
||||||
|
.customSanitizer(toIntOrNull)
|
||||||
.custom(isPluginTypeValid).withMessage('Should have a valid plugin type'),
|
.custom(isPluginTypeValid).withMessage('Should have a valid plugin type'),
|
||||||
query('uninstalled')
|
query('uninstalled')
|
||||||
.optional()
|
.optional()
|
||||||
|
@ -165,6 +166,7 @@ const listAvailablePluginsValidator = [
|
||||||
.exists().withMessage('Should have a valid search'),
|
.exists().withMessage('Should have a valid search'),
|
||||||
query('pluginType')
|
query('pluginType')
|
||||||
.optional()
|
.optional()
|
||||||
|
.customSanitizer(toIntOrNull)
|
||||||
.custom(isPluginTypeValid).withMessage('Should have a valid plugin type'),
|
.custom(isPluginTypeValid).withMessage('Should have a valid plugin type'),
|
||||||
query('currentPeerTubeEngine')
|
query('currentPeerTubeEngine')
|
||||||
.optional()
|
.optional()
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
import { body, param, query } from 'express-validator'
|
import { body, param, query } from 'express-validator'
|
||||||
import { isBooleanValid, isIdOrUUIDValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
|
import { isBooleanValid, isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
|
||||||
import { logger } from '../../../helpers/logger'
|
|
||||||
import { areValidationErrors } from '../utils'
|
|
||||||
import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist'
|
import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
import { doesVideoBlacklistExist, doesVideoExist } from '../../../helpers/middlewares'
|
import { doesVideoBlacklistExist, doesVideoExist } from '../../../helpers/middlewares'
|
||||||
|
import { areValidationErrors } from '../utils'
|
||||||
|
|
||||||
const videosBlacklistRemoveValidator = [
|
const videosBlacklistRemoveValidator = [
|
||||||
param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
|
param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
|
||||||
|
@ -68,6 +68,7 @@ const videosBlacklistUpdateValidator = [
|
||||||
const videosBlacklistFiltersValidator = [
|
const videosBlacklistFiltersValidator = [
|
||||||
query('type')
|
query('type')
|
||||||
.optional()
|
.optional()
|
||||||
|
.customSanitizer(toIntOrNull)
|
||||||
.custom(isVideoBlacklistTypeValid).withMessage('Should have a valid video blacklist type attribute'),
|
.custom(isVideoBlacklistTypeValid).withMessage('Should have a valid video blacklist type attribute'),
|
||||||
query('search')
|
query('search')
|
||||||
.optional()
|
.optional()
|
||||||
|
|
|
@ -421,6 +421,10 @@ describe('Test abuses API validators', function () {
|
||||||
it('Should fail when creating abuse message of a remote abuse', async function () {
|
it('Should fail when creating abuse message of a remote abuse', async function () {
|
||||||
await addAbuseMessage(server.url, server.accessToken, remoteAbuseId, 'message', 400)
|
await addAbuseMessage(server.url, server.accessToken, remoteAbuseId, 'message', 400)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
after(async function () {
|
||||||
|
await cleanupTests([ anotherServer ])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
|
|
Loading…
Reference in New Issue