aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+signup/+register/register.component.html4
-rw-r--r--client/src/app/shared/video-blacklist/video-blacklist.service.ts9
-rw-r--r--client/src/app/shared/video/video-miniature.component.html2
-rw-r--r--client/src/app/shared/video/video-miniature.component.ts2
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts2
-rw-r--r--server/models/utils.ts10
-rw-r--r--server/models/video/video-blacklist.ts7
7 files changed, 19 insertions, 17 deletions
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html
index e7440fe1e..906e29aed 100644
--- a/client/src/app/+signup/+register/register.component.html
+++ b/client/src/app/+signup/+register/register.component.html
@@ -10,7 +10,7 @@
10 <div class="wrapper" [hidden]="signupDone"> 10 <div class="wrapper" [hidden]="signupDone">
11 <div class="register-form"> 11 <div class="register-form">
12 <my-custom-stepper linear *ngIf="!signupDone"> 12 <my-custom-stepper linear *ngIf="!signupDone">
13 <cdk-step [stepControl]="formStepUser" i18n-label label="User information"> 13 <cdk-step [stepControl]="formStepUser" i18n-label label="User">
14 <my-register-step-user 14 <my-register-step-user
15 [hasCodeOfConduct]="!!aboutHtml.codeOfConduct" 15 [hasCodeOfConduct]="!!aboutHtml.codeOfConduct"
16 (formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()" 16 (formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()"
@@ -20,7 +20,7 @@
20 <button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button> 20 <button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button>
21 </cdk-step> 21 </cdk-step>
22 22
23 <cdk-step [stepControl]="formStepChannel" i18n-label label="Channel information"> 23 <cdk-step [stepControl]="formStepChannel" i18n-label label="Channel">
24 <my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel> 24 <my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel>
25 25
26 <button i18n cdkStepperNext (click)="signup()" 26 <button i18n cdkStepperNext (click)="signup()"
diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts
index a9eab9b6f..d65da85fe 100644
--- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts
+++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts
@@ -34,7 +34,7 @@ export class VideoBlacklistService {
34 ) 34 )
35 } 35 }
36 36
37 getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<{ videos: Video[], totalVideos: number}> { 37 getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<ResultList<Video>> {
38 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 38 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
39 39
40 // prioritize first created since waiting longest 40 // prioritize first created since waiting longest
@@ -48,9 +48,10 @@ export class VideoBlacklistService {
48 return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) 48 return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params })
49 .pipe( 49 .pipe(
50 map(res => { 50 map(res => {
51 const videos = res.data.map(videoBlacklist => new Video(videoBlacklist.video)) 51 return {
52 const totalVideos = res.total 52 total: res.total,
53 return { videos, totalVideos } 53 data: res.data.map(videoBlacklist => new Video(videoBlacklist.video))
54 }
54 }), 55 }),
55 catchError(res => this.restExtractor.handleError(res)) 56 catchError(res => this.restExtractor.handleError(res))
56 ) 57 )
diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html
index 51ca1393d..5d5691b75 100644
--- a/client/src/app/shared/video/video-miniature.component.html
+++ b/client/src/app/shared/video/video-miniature.component.html
@@ -31,7 +31,7 @@
31 31
32 <div class="video-info-privacy"> 32 <div class="video-info-privacy">
33 <ng-container *ngIf="displayOptions.privacyText">{{ video.privacy.label }}</ng-container> 33 <ng-container *ngIf="displayOptions.privacyText">{{ video.privacy.label }}</ng-container>
34 <ng-container *ngIf="displayOptions.privacyText && getStateLabel(video)"> - </ng-container> 34 <ng-container *ngIf="displayOptions.privacyText && displayOptions.state && getStateLabel(video)"> - </ng-container>
35 <ng-container *ngIf="displayOptions.state">{{ getStateLabel(video) }}</ng-container> 35 <ng-container *ngIf="displayOptions.state">{{ getStateLabel(video) }}</ng-container>
36 </div> 36 </div>
37 37
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts
index 48475033c..d5c7dfd9b 100644
--- a/client/src/app/shared/video/video-miniature.component.ts
+++ b/client/src/app/shared/video/video-miniature.component.ts
@@ -95,6 +95,8 @@ export class VideoMiniatureComponent implements OnInit {
95 } 95 }
96 96
97 getStateLabel (video: Video) { 97 getStateLabel (video: Video) {
98 if (!video.state) return ''
99
98 if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { 100 if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) {
99 return this.i18n('Published') 101 return this.i18n('Published')
100 } 102 }
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index d326148d0..1e30f6ebc 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -261,7 +261,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
261 } 261 }
262 262
263 private async purgeCacheIfNeeded (candidateToDuplicate: CandidateToDuplicate) { 263 private async purgeCacheIfNeeded (candidateToDuplicate: CandidateToDuplicate) {
264 while (this.isTooHeavy(candidateToDuplicate)) { 264 while (await this.isTooHeavy(candidateToDuplicate)) {
265 const redundancy = candidateToDuplicate.redundancy 265 const redundancy = candidateToDuplicate.redundancy
266 const toDelete = await VideoRedundancyModel.loadOldestLocalExpired(redundancy.strategy, redundancy.minLifetime) 266 const toDelete = await VideoRedundancyModel.loadOldestLocalExpired(redundancy.strategy, redundancy.minLifetime)
267 if (!toDelete) return 267 if (!toDelete) return
diff --git a/server/models/utils.ts b/server/models/utils.ts
index 24890f961..e7e6ddde1 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -1,9 +1,9 @@
1import { Model, Sequelize } from 'sequelize-typescript' 1import { Model, Sequelize } from 'sequelize-typescript'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { Col } from 'sequelize/types/lib/utils' 3import { Col } from 'sequelize/types/lib/utils'
4import { OrderItem, literal } from 'sequelize' 4import { col, literal, OrderItem } from 'sequelize'
5 5
6type SortType = { sortModel: any, sortValue: string } 6type SortType = { sortModel: string, sortValue: string }
7 7
8// Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ] 8// Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ]
9function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { 9function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
@@ -51,10 +51,10 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
51 return [ firstSort, lastSort ] 51 return [ firstSort, lastSort ]
52} 52}
53 53
54function getSortOnModel (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { 54function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
55 const [ firstSort ] = getSort(value) 55 const [ firstSort ] = getSort(value)
56 56
57 if (model) return [ [ model, firstSort[0], firstSort[1] ], lastSort ] 57 if (model) return [ [ literal(`"${model}.${firstSort[ 0 ]}" ${firstSort[ 1 ]}`) ], lastSort ] as any[] // FIXME: typings
58 return [ firstSort, lastSort ] 58 return [ firstSort, lastSort ]
59} 59}
60 60
@@ -155,7 +155,7 @@ export {
155 buildLocalAccountIdsIn, 155 buildLocalAccountIdsIn,
156 getSort, 156 getSort,
157 getVideoSort, 157 getVideoSort,
158 getSortOnModel, 158 getBlacklistSort,
159 createSimilarityAttribute, 159 createSimilarityAttribute,
160 throwIfNotValid, 160 throwIfNotValid,
161 buildServerIdsFollowedBy, 161 buildServerIdsFollowedBy,
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts
index b4df6cd6a..533bfe1ad 100644
--- a/server/models/video/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -1,11 +1,11 @@
1import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' 1import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
2import { getSortOnModel, SortType, throwIfNotValid } from '../utils' 2import { getBlacklistSort, SortType, throwIfNotValid } from '../utils'
3import { VideoModel } from './video' 3import { VideoModel } from './video'
4import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel' 4import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'
5import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' 5import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist'
6import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' 6import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos'
7import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 7import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
8import { FindOptions } from 'sequelize' 8import { FindOptions, literal } from 'sequelize'
9import { ThumbnailModel } from './thumbnail' 9import { ThumbnailModel } from './thumbnail'
10import * as Bluebird from 'bluebird' 10import * as Bluebird from 'bluebird'
11import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/typings/models' 11import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/typings/models'
@@ -59,14 +59,13 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
59 return { 59 return {
60 offset: start, 60 offset: start,
61 limit: count, 61 limit: count,
62 order: getSortOnModel(sort.sortModel, sort.sortValue) 62 order: getBlacklistSort(sort.sortModel, sort.sortValue)
63 } 63 }
64 } 64 }
65 65
66 const countQuery = buildBaseQuery() 66 const countQuery = buildBaseQuery()
67 67
68 const findQuery = buildBaseQuery() 68 const findQuery = buildBaseQuery()
69 findQuery.subQuery = false
70 findQuery.include = [ 69 findQuery.include = [
71 { 70 {
72 model: VideoModel, 71 model: VideoModel,