1
0
Fork 0

Merge branch 'release/1.4.0' into develop

This commit is contained in:
Chocobozzz 2019-09-05 10:19:35 +02:00
commit 00aab0666c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 19 additions and 17 deletions

View file

@ -10,7 +10,7 @@
<div class="wrapper" [hidden]="signupDone">
<div class="register-form">
<my-custom-stepper linear *ngIf="!signupDone">
<cdk-step [stepControl]="formStepUser" i18n-label label="User information">
<cdk-step [stepControl]="formStepUser" i18n-label label="User">
<my-register-step-user
[hasCodeOfConduct]="!!aboutHtml.codeOfConduct"
(formBuilt)="onUserFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()"
@ -20,7 +20,7 @@
<button i18n cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid">Next</button>
</cdk-step>
<cdk-step [stepControl]="formStepChannel" i18n-label label="Channel information">
<cdk-step [stepControl]="formStepChannel" i18n-label label="Channel">
<my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel>
<button i18n cdkStepperNext (click)="signup()"

View file

@ -34,7 +34,7 @@ export class VideoBlacklistService {
)
}
getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<{ videos: Video[], totalVideos: number}> {
getAutoBlacklistedAsVideoList (videoPagination: ComponentPagination): Observable<ResultList<Video>> {
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
// prioritize first created since waiting longest
@ -48,9 +48,10 @@ export class VideoBlacklistService {
return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params })
.pipe(
map(res => {
const videos = res.data.map(videoBlacklist => new Video(videoBlacklist.video))
const totalVideos = res.total
return { videos, totalVideos }
return {
total: res.total,
data: res.data.map(videoBlacklist => new Video(videoBlacklist.video))
}
}),
catchError(res => this.restExtractor.handleError(res))
)

View file

@ -31,7 +31,7 @@
<div class="video-info-privacy">
<ng-container *ngIf="displayOptions.privacyText">{{ video.privacy.label }}</ng-container>
<ng-container *ngIf="displayOptions.privacyText && getStateLabel(video)"> - </ng-container>
<ng-container *ngIf="displayOptions.privacyText && displayOptions.state && getStateLabel(video)"> - </ng-container>
<ng-container *ngIf="displayOptions.state">{{ getStateLabel(video) }}</ng-container>
</div>

View file

@ -95,6 +95,8 @@ export class VideoMiniatureComponent implements OnInit {
}
getStateLabel (video: Video) {
if (!video.state) return ''
if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) {
return this.i18n('Published')
}

View file

@ -261,7 +261,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
}
private async purgeCacheIfNeeded (candidateToDuplicate: CandidateToDuplicate) {
while (this.isTooHeavy(candidateToDuplicate)) {
while (await this.isTooHeavy(candidateToDuplicate)) {
const redundancy = candidateToDuplicate.redundancy
const toDelete = await VideoRedundancyModel.loadOldestLocalExpired(redundancy.strategy, redundancy.minLifetime)
if (!toDelete) return

View file

@ -1,9 +1,9 @@
import { Model, Sequelize } from 'sequelize-typescript'
import * as validator from 'validator'
import { Col } from 'sequelize/types/lib/utils'
import { OrderItem, literal } from 'sequelize'
import { col, literal, OrderItem } from 'sequelize'
type SortType = { sortModel: any, sortValue: string }
type SortType = { sortModel: string, sortValue: string }
// Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ]
function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
@ -51,10 +51,10 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
return [ firstSort, lastSort ]
}
function getSortOnModel (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
const [ firstSort ] = getSort(value)
if (model) return [ [ model, firstSort[0], firstSort[1] ], lastSort ]
if (model) return [ [ literal(`"${model}.${firstSort[ 0 ]}" ${firstSort[ 1 ]}`) ], lastSort ] as any[] // FIXME: typings
return [ firstSort, lastSort ]
}
@ -155,7 +155,7 @@ export {
buildLocalAccountIdsIn,
getSort,
getVideoSort,
getSortOnModel,
getBlacklistSort,
createSimilarityAttribute,
throwIfNotValid,
buildServerIdsFollowedBy,

View file

@ -1,11 +1,11 @@
import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { getSortOnModel, SortType, throwIfNotValid } from '../utils'
import { getBlacklistSort, SortType, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'
import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist'
import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos'
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
import { FindOptions } from 'sequelize'
import { FindOptions, literal } from 'sequelize'
import { ThumbnailModel } from './thumbnail'
import * as Bluebird from 'bluebird'
import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/typings/models'
@ -59,14 +59,13 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
return {
offset: start,
limit: count,
order: getSortOnModel(sort.sortModel, sort.sortValue)
order: getBlacklistSort(sort.sortModel, sort.sortValue)
}
}
const countQuery = buildBaseQuery()
const findQuery = buildBaseQuery()
findQuery.subQuery = false
findQuery.include = [
{
model: VideoModel,