diff options
7 files changed, 27 insertions, 20 deletions
diff --git a/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.html b/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.html index 62dde60bb..e2193b630 100644 --- a/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.html | |||
@@ -1,4 +1,5 @@ | |||
1 | <my-videos-selection | 1 | <my-videos-selection |
2 | [pagination]="pagination" | ||
2 | [(selection)]="selection" | 3 | [(selection)]="selection" |
3 | [(videosModel)]="videos" | 4 | [(videosModel)]="videos" |
4 | [miniatureDisplayOptions]="miniatureDisplayOptions" | 5 | [miniatureDisplayOptions]="miniatureDisplayOptions" |
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html index 38b48f1d6..2854093c4 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html | |||
@@ -1,4 +1,5 @@ | |||
1 | <my-videos-selection | 1 | <my-videos-selection |
2 | [pagination]="pagination" | ||
2 | [(selection)]="selection" | 3 | [(selection)]="selection" |
3 | [(videosModel)]="videos" | 4 | [(videosModel)]="videos" |
4 | [miniatureDisplayOptions]="miniatureDisplayOptions" | 5 | [miniatureDisplayOptions]="miniatureDisplayOptions" |
diff --git a/client/src/app/shared/buttons/delete-button.component.html b/client/src/app/shared/buttons/delete-button.component.html index d278e7015..25196fbd5 100644 --- a/client/src/app/shared/buttons/delete-button.component.html +++ b/client/src/app/shared/buttons/delete-button.component.html | |||
@@ -1,4 +1,4 @@ | |||
1 | <span class="action-button action-button-delete grey-button" [title]="getTitle()" role="button"> | 1 | <span class="action-button action-button-delete grey-button" [title]="title" role="button"> |
2 | <my-global-icon iconName="delete"></my-global-icon> | 2 | <my-global-icon iconName="delete"></my-global-icon> |
3 | 3 | ||
4 | <span class="button-label" *ngIf="label">{{ label }}</span> | 4 | <span class="button-label" *ngIf="label">{{ label }}</span> |
diff --git a/client/src/app/shared/buttons/delete-button.component.ts b/client/src/app/shared/buttons/delete-button.component.ts index 8e285d982..39e31900f 100644 --- a/client/src/app/shared/buttons/delete-button.component.ts +++ b/client/src/app/shared/buttons/delete-button.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
@@ -7,12 +7,14 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
7 | templateUrl: './delete-button.component.html' | 7 | templateUrl: './delete-button.component.html' |
8 | }) | 8 | }) |
9 | 9 | ||
10 | export class DeleteButtonComponent { | 10 | export class DeleteButtonComponent implements OnInit { |
11 | @Input() label: string | 11 | @Input() label: string |
12 | 12 | ||
13 | title: string | ||
14 | |||
13 | constructor (private i18n: I18n) { } | 15 | constructor (private i18n: I18n) { } |
14 | 16 | ||
15 | getTitle () { | 17 | ngOnInit () { |
16 | return this.label || this.i18n('Delete') | 18 | this.title = this.label || this.i18n('Delete') |
17 | } | 19 | } |
18 | } | 20 | } |
diff --git a/client/src/app/shared/video/videos-selection.component.html b/client/src/app/shared/video/videos-selection.component.html index 53809b6fd..120c168cd 100644 --- a/client/src/app/shared/video/videos-selection.component.html +++ b/client/src/app/shared/video/videos-selection.component.html | |||
@@ -1,7 +1,8 @@ | |||
1 | <div class="no-results" i18n *ngIf="pagination.totalItems === 0">No results.</div> | 1 | <div class="no-results" i18n *ngIf="pagination.totalItems === 0">No results.</div> |
2 | 2 | ||
3 | <div myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" class="videos"> | 3 | <div myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" class="videos"> |
4 | <div class="video" *ngFor="let video of videos; let i = index"> | 4 | <div class="video" *ngFor="let video of videos; let i = index; trackBy: videoById"> |
5 | |||
5 | <div class="checkbox-container"> | 6 | <div class="checkbox-container"> |
6 | <my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="_selection[video.id]"></my-peertube-checkbox> | 7 | <my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="_selection[video.id]"></my-peertube-checkbox> |
7 | </div> | 8 | </div> |
diff --git a/client/src/app/shared/video/videos-selection.component.ts b/client/src/app/shared/video/videos-selection.component.ts index b6bedafd8..955ebca9f 100644 --- a/client/src/app/shared/video/videos-selection.component.ts +++ b/client/src/app/shared/video/videos-selection.component.ts | |||
@@ -19,6 +19,7 @@ import { Observable } from 'rxjs' | |||
19 | import { Video } from '@app/shared/video/video.model' | 19 | import { Video } from '@app/shared/video/video.model' |
20 | import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' | 20 | import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' |
21 | import { VideoSortField } from '@app/shared/video/sort-field.type' | 21 | import { VideoSortField } from '@app/shared/video/sort-field.type' |
22 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | ||
22 | 23 | ||
23 | export type SelectionType = { [ id: number ]: boolean } | 24 | export type SelectionType = { [ id: number ]: boolean } |
24 | 25 | ||
@@ -28,6 +29,7 @@ export type SelectionType = { [ id: number ]: boolean } | |||
28 | styleUrls: [ './videos-selection.component.scss' ] | 29 | styleUrls: [ './videos-selection.component.scss' ] |
29 | }) | 30 | }) |
30 | export class VideosSelectionComponent extends AbstractVideoList implements OnInit, OnDestroy, AfterContentInit { | 31 | export class VideosSelectionComponent extends AbstractVideoList implements OnInit, OnDestroy, AfterContentInit { |
32 | @Input() pagination: ComponentPagination | ||
31 | @Input() titlePage: string | 33 | @Input() titlePage: string |
32 | @Input() miniatureDisplayOptions: MiniatureDisplayOptions | 34 | @Input() miniatureDisplayOptions: MiniatureDisplayOptions |
33 | @Input() getVideosObservableFunction: (page: number, sort?: VideoSortField) => Observable<{ videos: Video[], totalVideos: number }> | 35 | @Input() getVideosObservableFunction: (page: number, sort?: VideoSortField) => Observable<{ videos: Video[], totalVideos: number }> |
@@ -52,18 +54,6 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni | |||
52 | super() | 54 | super() |
53 | } | 55 | } |
54 | 56 | ||
55 | ngAfterContentInit () { | ||
56 | { | ||
57 | const t = this.templates.find(t => t.name === 'rowButtons') | ||
58 | if (t) this.rowButtonsTemplate = t.template | ||
59 | } | ||
60 | |||
61 | { | ||
62 | const t = this.templates.find(t => t.name === 'globalButtons') | ||
63 | if (t) this.globalButtonsTemplate = t.template | ||
64 | } | ||
65 | } | ||
66 | |||
67 | @Input() get selection () { | 57 | @Input() get selection () { |
68 | return this._selection | 58 | return this._selection |
69 | } | 59 | } |
@@ -86,6 +76,18 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni | |||
86 | super.ngOnInit() | 76 | super.ngOnInit() |
87 | } | 77 | } |
88 | 78 | ||
79 | ngAfterContentInit () { | ||
80 | { | ||
81 | const t = this.templates.find(t => t.name === 'rowButtons') | ||
82 | if (t) this.rowButtonsTemplate = t.template | ||
83 | } | ||
84 | |||
85 | { | ||
86 | const t = this.templates.find(t => t.name === 'globalButtons') | ||
87 | if (t) this.globalButtonsTemplate = t.template | ||
88 | } | ||
89 | } | ||
90 | |||
89 | ngOnDestroy () { | 91 | ngOnDestroy () { |
90 | super.ngOnDestroy() | 92 | super.ngOnDestroy() |
91 | } | 93 | } |
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index d9fe9dfc9..3bd74460d 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 1 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | import { getSortOnModel, SortType, throwIfNotValid } from '../utils' | 2 | import { getSortOnModel, SortType, throwIfNotValid } from '../utils' |
3 | import { VideoModel } from './video' | 3 | import { VideoModel, ScopeNames as VideoModelScopeNames } from './video' |
4 | import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' | 4 | import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' |
5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' | 5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' |
6 | import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' | 6 | import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' |
@@ -58,7 +58,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | |||
58 | order: getSortOnModel(sort.sortModel, sort.sortValue), | 58 | order: getSortOnModel(sort.sortModel, sort.sortValue), |
59 | include: [ | 59 | include: [ |
60 | { | 60 | { |
61 | model: VideoModel, | 61 | model: VideoModel.scope(VideoModelScopeNames.WITH_THUMBNAILS), |
62 | required: true, | 62 | required: true, |
63 | include: [ | 63 | include: [ |
64 | { | 64 | { |