diff options
Diffstat (limited to 'client/src/app/videos')
49 files changed, 523 insertions, 327 deletions
diff --git a/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts new file mode 100644 index 000000000..b05852ff8 --- /dev/null +++ b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts | |||
@@ -0,0 +1,94 @@ | |||
1 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
2 | import { Injectable } from '@angular/core' | ||
3 | |||
4 | @Injectable() | ||
5 | export class I18nPrimengCalendarService { | ||
6 | private readonly calendarLocale: any = {} | ||
7 | |||
8 | constructor (private i18n: I18n) { | ||
9 | this.calendarLocale = { | ||
10 | firstDayOfWeek: 0, | ||
11 | dayNames: [ | ||
12 | this.i18n('Sunday'), | ||
13 | this.i18n('Monday'), | ||
14 | this.i18n('Tuesday'), | ||
15 | this.i18n('Wednesday'), | ||
16 | this.i18n('Thursday'), | ||
17 | this.i18n('Friday'), | ||
18 | this.i18n('Saturday') | ||
19 | ], | ||
20 | |||
21 | dayNamesShort: [ | ||
22 | this.i18n({ value: 'Sun', description: 'Day name short' }), | ||
23 | this.i18n({ value: 'Mon', description: 'Day name short' }), | ||
24 | this.i18n({ value: 'Tue', description: 'Day name short' }), | ||
25 | this.i18n({ value: 'Wed', description: 'Day name short' }), | ||
26 | this.i18n({ value: 'Thu', description: 'Day name short' }), | ||
27 | this.i18n({ value: 'Fri', description: 'Day name short' }), | ||
28 | this.i18n({ value: 'Sat', description: 'Day name short' }) | ||
29 | ], | ||
30 | |||
31 | dayNamesMin: [ | ||
32 | this.i18n({ value: 'Su', description: 'Day name min' }), | ||
33 | this.i18n({ value: 'Mo', description: 'Day name min' }), | ||
34 | this.i18n({ value: 'Tu', description: 'Day name min' }), | ||
35 | this.i18n({ value: 'We', description: 'Day name min' }), | ||
36 | this.i18n({ value: 'Th', description: 'Day name min' }), | ||
37 | this.i18n({ value: 'Fr', description: 'Day name min' }), | ||
38 | this.i18n({ value: 'Sa', description: 'Day name min' }) | ||
39 | ], | ||
40 | |||
41 | monthNames: [ | ||
42 | this.i18n('January'), | ||
43 | this.i18n('February'), | ||
44 | this.i18n('March'), | ||
45 | this.i18n('April'), | ||
46 | this.i18n('May'), | ||
47 | this.i18n('June'), | ||
48 | this.i18n('July'), | ||
49 | this.i18n('August'), | ||
50 | this.i18n('September'), | ||
51 | this.i18n('October'), | ||
52 | this.i18n('November'), | ||
53 | this.i18n('December') | ||
54 | ], | ||
55 | |||
56 | monthNamesShort: [ | ||
57 | this.i18n({ value: 'Jan', description: 'Month name short' }), | ||
58 | this.i18n({ value: 'Feb', description: 'Month name short' }), | ||
59 | this.i18n({ value: 'Mar', description: 'Month name short' }), | ||
60 | this.i18n({ value: 'Apr', description: 'Month name short' }), | ||
61 | this.i18n({ value: 'May', description: 'Month name short' }), | ||
62 | this.i18n({ value: 'Jun', description: 'Month name short' }), | ||
63 | this.i18n({ value: 'Jul', description: 'Month name short' }), | ||
64 | this.i18n({ value: 'Aug', description: 'Month name short' }), | ||
65 | this.i18n({ value: 'Sep', description: 'Month name short' }), | ||
66 | this.i18n({ value: 'Oct', description: 'Month name short' }), | ||
67 | this.i18n({ value: 'Nov', description: 'Month name short' }), | ||
68 | this.i18n({ value: 'Dec', description: 'Month name short' }) | ||
69 | ], | ||
70 | |||
71 | today: this.i18n('Today'), | ||
72 | |||
73 | clear: this.i18n('Clear') | ||
74 | } | ||
75 | } | ||
76 | |||
77 | getCalendarLocale () { | ||
78 | return this.calendarLocale | ||
79 | } | ||
80 | |||
81 | getTimezone () { | ||
82 | const gmt = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1] | ||
83 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone | ||
84 | |||
85 | return `${timezone} - ${gmt}` | ||
86 | } | ||
87 | |||
88 | getDateFormat () { | ||
89 | return this.i18n({ | ||
90 | value: 'yy-mm-dd ', | ||
91 | description: 'Date format in this locale.' | ||
92 | }) | ||
93 | } | ||
94 | } | ||
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts index 9856aac9e..a90d04ce8 100644 --- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts | |||
@@ -1,11 +1,9 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { FormReactive } from '@app/shared' | ||
3 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
4 | import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validators/video-captions-validators.service' | ||
5 | import { ServerService } from '@app/core' | 2 | import { ServerService } from '@app/core' |
6 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 3 | import { FormReactive, FormValidatorService, VideoCaptionsValidatorsService } from '@app/shared/shared-forms' |
4 | import { VideoCaptionEdit } from '@app/shared/shared-main' | ||
7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' |
8 | import { ServerConfig, VideoConstant } from '../../../../../../shared' | 6 | import { ServerConfig, VideoConstant } from '@shared/models' |
9 | 7 | ||
10 | @Component({ | 8 | @Component({ |
11 | selector: 'my-video-caption-add-modal', | 9 | selector: 'my-video-caption-add-modal', |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index 15073fc44..239e453ad 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts | |||
@@ -1,19 +1,13 @@ | |||
1 | import { map } from 'rxjs/operators' | ||
1 | import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' |
2 | import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' | 3 | import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ServerService } from '@app/core' |
4 | import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' | 5 | import { removeElementFromArray } from '@app/helpers' |
5 | import { Notifier } from '@app/core' | 6 | import { FormReactiveValidationMessages, FormValidatorService, VideoValidatorsService } from '@app/shared/shared-forms' |
6 | import { ServerService } from '../../../core/server' | 7 | import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' |
7 | import { VideoEdit } from '../../../shared/video/video-edit.model' | 8 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' |
8 | import { map } from 'rxjs/operators' | 9 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' |
9 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 10 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
10 | import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar' | ||
11 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
12 | import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' | ||
13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | ||
14 | import { removeElementFromArray } from '@app/shared/misc/utils' | ||
15 | import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared' | ||
16 | import { VideoService } from '@app/shared/video/video.service' | ||
17 | 11 | ||
18 | @Component({ | 12 | @Component({ |
19 | selector: 'my-video-edit', | 13 | selector: 'my-video-edit', |
@@ -60,11 +54,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
60 | constructor ( | 54 | constructor ( |
61 | private formValidatorService: FormValidatorService, | 55 | private formValidatorService: FormValidatorService, |
62 | private videoValidatorsService: VideoValidatorsService, | 56 | private videoValidatorsService: VideoValidatorsService, |
63 | private videoCaptionService: VideoCaptionService, | ||
64 | private videoService: VideoService, | 57 | private videoService: VideoService, |
65 | private route: ActivatedRoute, | ||
66 | private router: Router, | ||
67 | private notifier: Notifier, | ||
68 | private serverService: ServerService, | 58 | private serverService: ServerService, |
69 | private i18nPrimengCalendarService: I18nPrimengCalendarService, | 59 | private i18nPrimengCalendarService: I18nPrimengCalendarService, |
70 | private ngZone: NgZone | 60 | private ngZone: NgZone |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.module.ts b/client/src/app/videos/+video-edit/shared/video-edit.module.ts index 1357d607c..96061a300 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.module.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.module.ts | |||
@@ -1,16 +1,20 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { TagInputModule } from 'ngx-chips' | 1 | import { TagInputModule } from 'ngx-chips' |
3 | import { SharedModule } from '../../../shared/' | ||
4 | import { VideoEditComponent } from './video-edit.component' | ||
5 | import { CalendarModule } from 'primeng/calendar' | 2 | import { CalendarModule } from 'primeng/calendar' |
3 | import { NgModule } from '@angular/core' | ||
4 | import { SharedFormModule } from '@app/shared/shared-forms' | ||
5 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' | ||
6 | import { SharedMainModule } from '@app/shared/shared-main' | ||
6 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' | 7 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
8 | import { VideoEditComponent } from './video-edit.component' | ||
7 | 9 | ||
8 | @NgModule({ | 10 | @NgModule({ |
9 | imports: [ | 11 | imports: [ |
10 | TagInputModule, | 12 | TagInputModule, |
11 | CalendarModule, | 13 | CalendarModule, |
12 | 14 | ||
13 | SharedModule | 15 | SharedMainModule, |
16 | SharedFormModule, | ||
17 | SharedGlobalIconModule | ||
14 | ], | 18 | ], |
15 | 19 | ||
16 | declarations: [ | 20 | declarations: [ |
@@ -22,6 +26,10 @@ import { VideoCaptionAddModalComponent } from './video-caption-add-modal.compone | |||
22 | TagInputModule, | 26 | TagInputModule, |
23 | CalendarModule, | 27 | CalendarModule, |
24 | 28 | ||
29 | SharedMainModule, | ||
30 | SharedFormModule, | ||
31 | SharedGlobalIconModule, | ||
32 | |||
25 | VideoEditComponent | 33 | VideoEditComponent |
26 | ], | 34 | ], |
27 | 35 | ||
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 4d0b0b080..5b453a1d9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -1,17 +1,13 @@ | |||
1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' | 3 | import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' |
4 | import { AuthService, Notifier, ServerService } from '../../../core' | 4 | import { scrollToTop } from '@app/helpers' |
5 | import { VideoService } from '../../../shared/video/video.service' | 5 | import { FormValidatorService } from '@app/shared/shared-forms' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
7 | import { LoadingBarService } from '@ngx-loading-bar/core' | ||
8 | import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' | 7 | import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' |
9 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 8 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { VideoEdit } from '@app/shared/video/video-edit.model' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { FormValidatorService } from '@app/shared' | 10 | import { VideoPrivacy, VideoUpdate } from '@shared/models' |
12 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
13 | import { VideoImportService } from '@app/shared/video-import' | ||
14 | import { scrollToTop } from '@app/shared/misc/utils' | ||
15 | 11 | ||
16 | @Component({ | 12 | @Component({ |
17 | selector: 'my-video-import-torrent', | 13 | selector: 'my-video-import-torrent', |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 213c42333..d0bd1f54d 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -1,18 +1,14 @@ | |||
1 | import { map, switchMap } from 'rxjs/operators' | ||
1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' | 2 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' |
2 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
3 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' | 4 | import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' |
4 | import { AuthService, Notifier, ServerService } from '../../../core' | 5 | import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' |
5 | import { VideoService } from '../../../shared/video/video.service' | 6 | import { FormValidatorService } from '@app/shared/shared-forms' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
7 | import { LoadingBarService } from '@ngx-loading-bar/core' | ||
8 | import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' | 8 | import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' |
9 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { VideoEdit } from '@app/shared/video/video-edit.model' | 10 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { FormValidatorService } from '@app/shared' | 11 | import { VideoPrivacy, VideoUpdate } from '@shared/models' |
12 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
13 | import { VideoImportService } from '@app/shared/video-import' | ||
14 | import { scrollToTop, getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
15 | import { switchMap, map } from 'rxjs/operators' | ||
16 | 12 | ||
17 | @Component({ | 13 | @Component({ |
18 | selector: 'my-video-import-url', | 14 | selector: 'my-video-import-url', |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index b32f16950..94479321d 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts | |||
@@ -1,15 +1,11 @@ | |||
1 | import { catchError, switchMap, tap } from 'rxjs/operators' | ||
1 | import { EventEmitter, OnInit } from '@angular/core' | 2 | import { EventEmitter, OnInit } from '@angular/core' |
3 | import { AuthService, CanComponentDeactivateResult, Notifier, ServerService } from '@app/core' | ||
4 | import { populateAsyncUserVideoChannels } from '@app/helpers' | ||
5 | import { FormReactive } from '@app/shared/shared-forms' | ||
6 | import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | ||
2 | import { LoadingBarService } from '@ngx-loading-bar/core' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 8 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' |
4 | import { catchError, switchMap, tap } from 'rxjs/operators' | ||
5 | import { FormReactive } from '@app/shared' | ||
6 | import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared' | ||
7 | import { VideoService } from '@app/shared/video/video.service' | ||
8 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | ||
9 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
10 | import { VideoEdit } from '@app/shared/video/video-edit.model' | ||
11 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | ||
12 | import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service' | ||
13 | 9 | ||
14 | export abstract class VideoSend extends FormReactive implements OnInit { | 10 | export abstract class VideoSend extends FormReactive implements OnInit { |
15 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 11 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index 9ce3fbc6d..eb7ac32ae 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -1,19 +1,16 @@ | |||
1 | import { BytesPipe } from 'ngx-pipes' | ||
2 | import { Subscription } from 'rxjs' | ||
1 | import { HttpEventType, HttpResponse } from '@angular/common/http' | 3 | import { HttpEventType, HttpResponse } from '@angular/common/http' |
2 | import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 4 | import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
3 | import { Router } from '@angular/router' | 5 | import { Router } from '@angular/router' |
6 | import { AuthService, CanComponentDeactivate, Notifier, ServerService, UserService } from '@app/core' | ||
7 | import { scrollToTop } from '@app/helpers' | ||
8 | import { FormValidatorService } from '@app/shared/shared-forms' | ||
9 | import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | ||
10 | import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' | ||
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 11 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { BytesPipe } from 'ngx-pipes' | ||
6 | import { Subscription } from 'rxjs' | ||
7 | import { VideoPrivacy } from '../../../../../../shared/models/videos' | ||
8 | import { AuthService, Notifier, ServerService } from '../../../core' | ||
9 | import { VideoEdit } from '../../../shared/video/video-edit.model' | ||
10 | import { VideoService } from '../../../shared/video/video.service' | ||
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | 12 | import { I18n } from '@ngx-translate/i18n-polyfill' |
12 | import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' | 13 | import { VideoPrivacy } from '@shared/models' |
13 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | ||
14 | import { FormValidatorService, UserService } from '@app/shared' | ||
15 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
16 | import { scrollToTop } from '@app/shared/misc/utils' | ||
17 | 14 | ||
18 | @Component({ | 15 | @Component({ |
19 | selector: 'my-video-upload', | 16 | selector: 'my-video-upload', |
diff --git a/client/src/app/videos/+video-edit/video-add-routing.module.ts b/client/src/app/videos/+video-edit/video-add-routing.module.ts index e0fef7158..9ff66bea0 100644 --- a/client/src/app/videos/+video-edit/video-add-routing.module.ts +++ b/client/src/app/videos/+video-edit/video-add-routing.module.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | 3 | import { CanDeactivateGuard, LoginGuard } from '@app/core' | |
4 | import { MetaGuard } from '@ngx-meta/core' | 4 | import { MetaGuard } from '@ngx-meta/core' |
5 | |||
6 | import { LoginGuard } from '../../core' | ||
7 | import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service' | ||
8 | import { VideoAddComponent } from './video-add.component' | 5 | import { VideoAddComponent } from './video-add.component' |
9 | 6 | ||
10 | const videoAddRoutes: Routes = [ | 7 | const videoAddRoutes: Routes = [ |
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 30ab08ea0..5bd768809 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -1,10 +1,9 @@ | |||
1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' |
2 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 2 | import { AuthService, CanComponentDeactivate, ServerService } from '@app/core' |
3 | import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' | ||
4 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' | ||
5 | import { AuthService, ServerService } from '@app/core' | ||
6 | import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' | ||
7 | import { ServerConfig } from '@shared/models' | 3 | import { ServerConfig } from '@shared/models' |
4 | import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' | ||
5 | import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' | ||
6 | import { VideoUploadComponent } from './video-add-components/video-upload.component' | ||
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
10 | selector: 'my-videos-add', | 9 | selector: 'my-videos-add', |
diff --git a/client/src/app/videos/+video-edit/video-add.module.ts b/client/src/app/videos/+video-edit/video-add.module.ts index b8f5a9a47..477c1cf5e 100644 --- a/client/src/app/videos/+video-edit/video-add.module.ts +++ b/client/src/app/videos/+video-edit/video-add.module.ts | |||
@@ -1,20 +1,20 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { SharedModule } from '../../shared' | 2 | import { CanDeactivateGuard } from '@app/core' |
3 | import { VideoEditModule } from './shared/video-edit.module' | 3 | import { VideoEditModule } from './shared/video-edit.module' |
4 | import { DragDropDirective } from './video-add-components/drag-drop.directive' | ||
5 | import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' | ||
6 | import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' | ||
7 | import { VideoUploadComponent } from './video-add-components/video-upload.component' | ||
4 | import { VideoAddRoutingModule } from './video-add-routing.module' | 8 | import { VideoAddRoutingModule } from './video-add-routing.module' |
5 | import { VideoAddComponent } from './video-add.component' | 9 | import { VideoAddComponent } from './video-add.component' |
6 | import { DragDropDirective } from './video-add-components/drag-drop.directive' | ||
7 | import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service' | ||
8 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' | ||
9 | import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' | ||
10 | import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' | ||
11 | 10 | ||
12 | @NgModule({ | 11 | @NgModule({ |
13 | imports: [ | 12 | imports: [ |
14 | VideoAddRoutingModule, | 13 | VideoAddRoutingModule, |
15 | VideoEditModule, | 14 | |
16 | SharedModule | 15 | VideoEditModule |
17 | ], | 16 | ], |
17 | |||
18 | declarations: [ | 18 | declarations: [ |
19 | VideoAddComponent, | 19 | VideoAddComponent, |
20 | VideoUploadComponent, | 20 | VideoUploadComponent, |
@@ -22,10 +22,9 @@ import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-c | |||
22 | VideoImportTorrentComponent, | 22 | VideoImportTorrentComponent, |
23 | DragDropDirective | 23 | DragDropDirective |
24 | ], | 24 | ], |
25 | exports: [ | 25 | |
26 | VideoAddComponent, | 26 | exports: [ ], |
27 | DragDropDirective | 27 | |
28 | ], | ||
29 | providers: [ | 28 | providers: [ |
30 | CanDeactivateGuard | 29 | CanDeactivateGuard |
31 | ] | 30 | ] |
diff --git a/client/src/app/videos/+video-edit/video-update-routing.module.ts b/client/src/app/videos/+video-edit/video-update-routing.module.ts index 564b8fb45..a04351b05 100644 --- a/client/src/app/videos/+video-edit/video-update-routing.module.ts +++ b/client/src/app/videos/+video-edit/video-update-routing.module.ts | |||
@@ -1,12 +1,9 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | 3 | import { CanDeactivateGuard, LoginGuard } from '@app/core' | |
4 | import { MetaGuard } from '@ngx-meta/core' | 4 | import { MetaGuard } from '@ngx-meta/core' |
5 | |||
6 | import { LoginGuard } from '../../core' | ||
7 | import { VideoUpdateComponent } from './video-update.component' | 5 | import { VideoUpdateComponent } from './video-update.component' |
8 | import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' | 6 | import { VideoUpdateResolver } from './video-update.resolver' |
9 | import { CanDeactivateGuard } from '@app/shared/guards/can-deactivate-guard.service' | ||
10 | 7 | ||
11 | const videoUpdateRoutes: Routes = [ | 8 | const videoUpdateRoutes: Routes = [ |
12 | { | 9 | { |
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 20a607134..7bd6eb553 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -1,17 +1,11 @@ | |||
1 | import { map, switchMap } from 'rxjs/operators' | 1 | import { map, switchMap } from 'rxjs/operators' |
2 | import { Component, HostListener, OnInit } from '@angular/core' | 2 | import { Component, HostListener, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | ||
5 | import { Notifier } from '@app/core' | 4 | import { Notifier } from '@app/core' |
6 | import { ServerService } from '../../core' | 5 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
7 | import { FormReactive } from '../../shared' | 6 | import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' |
8 | import { VideoEdit } from '../../shared/video/video-edit.model' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
9 | import { VideoService } from '../../shared/video/video.service' | ||
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
12 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | ||
14 | import { VideoDetails } from '@app/shared/video/video-details.model' | ||
15 | import { VideoPrivacy } from '@shared/models' | 9 | import { VideoPrivacy } from '@shared/models' |
16 | 10 | ||
17 | @Component({ | 11 | @Component({ |
diff --git a/client/src/app/videos/+video-edit/video-update.module.ts b/client/src/app/videos/+video-edit/video-update.module.ts index d60aa699f..322c69629 100644 --- a/client/src/app/videos/+video-edit/video-update.module.ts +++ b/client/src/app/videos/+video-edit/video-update.module.ts | |||
@@ -1,25 +1,22 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { SharedModule } from '../../shared' | 2 | import { CanDeactivateGuard } from '@app/core' |
3 | import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' | ||
3 | import { VideoEditModule } from './shared/video-edit.module' | 4 | import { VideoEditModule } from './shared/video-edit.module' |
4 | import { VideoUpdateRoutingModule } from './video-update-routing.module' | 5 | import { VideoUpdateRoutingModule } from './video-update-routing.module' |
5 | import { VideoUpdateComponent } from './video-update.component' | 6 | import { VideoUpdateComponent } from './video-update.component' |
6 | import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' | ||
7 | import { CanDeactivateGuard } from '@app/shared/guards/can-deactivate-guard.service' | ||
8 | 7 | ||
9 | @NgModule({ | 8 | @NgModule({ |
10 | imports: [ | 9 | imports: [ |
11 | VideoUpdateRoutingModule, | 10 | VideoUpdateRoutingModule, |
12 | VideoEditModule, | 11 | |
13 | SharedModule | 12 | VideoEditModule |
14 | ], | 13 | ], |
15 | 14 | ||
16 | declarations: [ | 15 | declarations: [ |
17 | VideoUpdateComponent | 16 | VideoUpdateComponent |
18 | ], | 17 | ], |
19 | 18 | ||
20 | exports: [ | 19 | exports: [ ], |
21 | VideoUpdateComponent | ||
22 | ], | ||
23 | 20 | ||
24 | providers: [ | 21 | providers: [ |
25 | VideoUpdateResolver, | 22 | VideoUpdateResolver, |
diff --git a/client/src/app/videos/+video-edit/video-update.resolver.ts b/client/src/app/videos/+video-edit/video-update.resolver.ts index 4ac517d96..30bcf4d74 100644 --- a/client/src/app/videos/+video-edit/video-update.resolver.ts +++ b/client/src/app/videos/+video-edit/video-update.resolver.ts | |||
@@ -1,10 +1,8 @@ | |||
1 | import { forkJoin } from 'rxjs' | ||
2 | import { map, switchMap } from 'rxjs/operators' | ||
1 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
2 | import { VideoService } from '@app/shared/video/video.service' | ||
3 | import { ActivatedRouteSnapshot, Resolve } from '@angular/router' | 4 | import { ActivatedRouteSnapshot, Resolve } from '@angular/router' |
4 | import { map, switchMap } from 'rxjs/operators' | 5 | import { VideoCaptionService, VideoChannelService, VideoService } from '@app/shared/shared-main' |
5 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | ||
6 | import { VideoCaptionService } from '@app/shared/video-caption' | ||
7 | import { forkJoin } from 'rxjs' | ||
8 | 6 | ||
9 | @Injectable() | 7 | @Injectable() |
10 | export class VideoUpdateResolver implements Resolve<any> { | 8 | export class VideoUpdateResolver implements Resolve<any> { |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index e1a8f6260..79505c779 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -1,16 +1,13 @@ | |||
1 | import { Observable } from 'rxjs' | ||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
3 | import { Notifier } from '@app/core' | 4 | import { Notifier, User } from '@app/core' |
4 | import { Observable } from 'rxjs' | 5 | import { FormReactive, FormValidatorService, VideoCommentValidatorsService } from '@app/shared/shared-forms' |
5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 6 | import { Video } from '@app/shared/shared-main' |
6 | import { FormReactive } from '../../../shared' | 7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
7 | import { User } from '../../../shared/users' | 8 | import { VideoCommentCreate } from '@shared/models' |
8 | import { Video } from '../../../shared/video/video.model' | ||
9 | import { VideoComment } from './video-comment.model' | 9 | import { VideoComment } from './video-comment.model' |
10 | import { VideoCommentService } from './video-comment.service' | 10 | import { VideoCommentService } from './video-comment.service' |
11 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
12 | import { VideoCommentValidatorsService } from '@app/shared/forms/form-validators/video-comment-validators.service' | ||
13 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | ||
14 | 11 | ||
15 | @Component({ | 12 | @Component({ |
16 | selector: 'my-video-comment-add', | 13 | selector: 'my-video-comment-add', |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts index 1566d7369..7c2aaeadd 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '../../../../../../shared/models/videos/video-comment.model' | 1 | import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@shared/models' |
2 | import { VideoComment } from '@app/videos/+video-watch/comment/video-comment.model' | 2 | import { VideoComment } from './video-comment.model' |
3 | 3 | ||
4 | export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { | 4 | export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { |
5 | comment: VideoComment | 5 | comment: VideoComment |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts index 868addd58..27846c1ad 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts | |||
@@ -1,15 +1,10 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
2 | import { User, UserRight } from '../../../../../../shared/models/users' | 2 | import { MarkdownService, Notifier, UserService } from '@app/core' |
3 | import { AuthService } from '@app/core/auth' | 3 | import { AuthService } from '@app/core/auth' |
4 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { Account, Actor, Video } from '@app/shared/shared-main' |
5 | import { Video } from '@app/shared/video/video.model' | 5 | import { User, UserRight } from '@shared/models' |
6 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' | ||
6 | import { VideoComment } from './video-comment.model' | 7 | import { VideoComment } from './video-comment.model' |
7 | import { MarkdownService } from '@app/shared/renderer' | ||
8 | import { Account } from '@app/shared/account/account.model' | ||
9 | import { Notifier } from '@app/core' | ||
10 | import { UserService } from '@app/shared' | ||
11 | import { Actor } from '@app/shared/actor/actor.model' | ||
12 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
13 | 8 | ||
14 | @Component({ | 9 | @Component({ |
15 | selector: 'my-video-comment', | 10 | selector: 'my-video-comment', |
@@ -40,7 +35,6 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
40 | constructor ( | 35 | constructor ( |
41 | private markdownService: MarkdownService, | 36 | private markdownService: MarkdownService, |
42 | private authService: AuthService, | 37 | private authService: AuthService, |
43 | private accountService: AccountService, | ||
44 | private userService: UserService, | 38 | private userService: UserService, |
45 | private notifier: Notifier | 39 | private notifier: Notifier |
46 | ) {} | 40 | ) {} |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts index 171fc4acc..e85443196 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 1 | import { getAbsoluteAPIUrl } from '@app/helpers' |
2 | import { VideoComment as VideoCommentServerModel, VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 2 | import { Actor } from '@app/shared/shared-main' |
3 | import { Actor } from '@app/shared/actor/actor.model' | 3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel } from '@shared/models' |
4 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
5 | 4 | ||
6 | export class VideoComment implements VideoCommentServerModel { | 5 | export class VideoComment implements VideoCommentServerModel { |
7 | id: number | 6 | id: number |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index 0b0715390..a73fb9ca8 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts | |||
@@ -1,20 +1,19 @@ | |||
1 | import { Observable } from 'rxjs' | ||
1 | import { catchError, map } from 'rxjs/operators' | 2 | import { catchError, map } from 'rxjs/operators' |
2 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
4 | import { objectLineFeedToHtml } from '@app/shared/misc/utils' | 5 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' |
5 | import { Observable } from 'rxjs' | 6 | import { objectLineFeedToHtml } from '@app/helpers' |
6 | import { FeedFormat, ResultList } from '../../../../../../shared/models' | ||
7 | import { | 7 | import { |
8 | FeedFormat, | ||
9 | ResultList, | ||
8 | VideoComment as VideoCommentServerModel, | 10 | VideoComment as VideoCommentServerModel, |
9 | VideoCommentCreate, | 11 | VideoCommentCreate, |
10 | VideoCommentThreadTree as VideoCommentThreadTreeServerModel | 12 | VideoCommentThreadTree as VideoCommentThreadTreeServerModel |
11 | } from '../../../../../../shared/models/videos/video-comment.model' | 13 | } from '@shared/models' |
12 | import { environment } from '../../../../environments/environment' | 14 | import { environment } from '../../../../environments/environment' |
13 | import { RestExtractor, RestService } from '../../../shared/rest' | 15 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' |
14 | import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model' | ||
15 | import { CommentSortField } from '../../../shared/video/sort-field.type' | ||
16 | import { VideoComment } from './video-comment.model' | 16 | import { VideoComment } from './video-comment.model' |
17 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
18 | 17 | ||
19 | @Injectable() | 18 | @Injectable() |
20 | export class VideoCommentService { | 19 | export class VideoCommentService { |
@@ -52,7 +51,7 @@ export class VideoCommentService { | |||
52 | getVideoCommentThreads (parameters: { | 51 | getVideoCommentThreads (parameters: { |
53 | videoId: number | string, | 52 | videoId: number | string, |
54 | componentPagination: ComponentPaginationLight, | 53 | componentPagination: ComponentPaginationLight, |
55 | sort: CommentSortField | 54 | sort: string |
56 | }): Observable<ResultList<VideoComment>> { | 55 | }): Observable<ResultList<VideoComment>> { |
57 | const { videoId, componentPagination, sort } = parameters | 56 | const { videoId, componentPagination, sort } = parameters |
58 | 57 | ||
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index bba9f1372..df0018ec6 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts | |||
@@ -1,18 +1,13 @@ | |||
1 | import { Subject, Subscription } from 'rxjs' | ||
1 | import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 3 | import { ActivatedRoute } from '@angular/router' |
3 | import { ConfirmService, Notifier } from '@app/core' | 4 | import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User } from '@app/core' |
4 | import { Subject, Subscription } from 'rxjs' | 5 | import { HooksService } from '@app/core/plugins/hooks.service' |
5 | import { AuthService } from '../../../core/auth' | 6 | import { Syndication, VideoDetails } from '@app/shared/shared-main' |
6 | import { ComponentPagination, hasMoreItems } from '../../../shared/rest/component-pagination.model' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { User } from '../../../shared/users' | 8 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' |
8 | import { CommentSortField } from '../../../shared/video/sort-field.type' | ||
9 | import { VideoDetails } from '../../../shared/video/video-details.model' | ||
10 | import { VideoComment } from './video-comment.model' | 9 | import { VideoComment } from './video-comment.model' |
11 | import { VideoCommentService } from './video-comment.service' | 10 | import { VideoCommentService } from './video-comment.service' |
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
13 | import { Syndication } from '@app/shared/video/syndication.model' | ||
14 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
15 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
16 | 11 | ||
17 | @Component({ | 12 | @Component({ |
18 | selector: 'my-video-comments', | 13 | selector: 'my-video-comments', |
@@ -28,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
28 | 23 | ||
29 | comments: VideoComment[] = [] | 24 | comments: VideoComment[] = [] |
30 | highlightedThread: VideoComment | 25 | highlightedThread: VideoComment |
31 | sort: CommentSortField = '-createdAt' | 26 | sort = '-createdAt' |
32 | componentPagination: ComponentPagination = { | 27 | componentPagination: ComponentPagination = { |
33 | currentPage: 1, | 28 | currentPage: 1, |
34 | itemsPerPage: 10, | 29 | itemsPerPage: 10, |
@@ -154,7 +149,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
154 | this.viewReplies(commentTree.comment.id) | 149 | this.viewReplies(commentTree.comment.id) |
155 | } | 150 | } |
156 | 151 | ||
157 | handleSortChange (sort: CommentSortField) { | 152 | handleSortChange (sort: string) { |
158 | if (this.sort === sort) return | 153 | if (this.sort === sort) return |
159 | 154 | ||
160 | this.sort = sort | 155 | this.sort = sort |
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.ts b/client/src/app/videos/+video-watch/modal/video-share.component.ts index 3550556a0..b42b775c1 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-share.component.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' |
2 | import { VideoDetails } from '../../../shared/video/video-details.model' | ||
3 | import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' | 2 | import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { VideoCaption } from '@shared/models' | 4 | import { VideoCaption } from '@shared/models' |
6 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | 5 | import { VideoDetails } from '@app/shared/shared-main' |
6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' | ||
7 | 7 | ||
8 | type Customizations = { | 8 | type Customizations = { |
9 | startAtCheckbox: boolean | 9 | startAtCheckbox: boolean |
@@ -40,13 +40,9 @@ export class VideoShareComponent { | |||
40 | isAdvancedCustomizationCollapsed = true | 40 | isAdvancedCustomizationCollapsed = true |
41 | includeVideoInPlaylist = false | 41 | includeVideoInPlaylist = false |
42 | 42 | ||
43 | private currentVideoTimestamp: number | ||
44 | |||
45 | constructor (private modalService: NgbModal) { } | 43 | constructor (private modalService: NgbModal) { } |
46 | 44 | ||
47 | show (currentVideoTimestamp?: number) { | 45 | show (currentVideoTimestamp?: number) { |
48 | this.currentVideoTimestamp = currentVideoTimestamp | ||
49 | |||
50 | let subtitle: string | 46 | let subtitle: string |
51 | if (this.videoCaptions.length !== 0) { | 47 | if (this.videoCaptions.length !== 0) { |
52 | subtitle = this.videoCaptions[0].language.id | 48 | subtitle = this.videoCaptions[0].language.id |
diff --git a/client/src/app/videos/+video-watch/modal/video-support.component.ts b/client/src/app/videos/+video-watch/modal/video-support.component.ts index 0058172f2..48d5f2948 100644 --- a/client/src/app/videos/+video-watch/modal/video-support.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-support.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, Input, ViewChild } from '@angular/core' | 1 | import { Component, Input, ViewChild } from '@angular/core' |
2 | import { VideoDetails } from '../../../shared/video/video-details.model' | 2 | import { MarkdownService } from '@app/core' |
3 | import { VideoDetails } from '@app/shared/shared-main' | ||
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { MarkdownService } from '@app/shared/renderer' | ||
5 | 5 | ||
6 | @Component({ | 6 | @Component({ |
7 | selector: 'my-video-support', | 7 | selector: 'my-video-support', |
diff --git a/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts b/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts new file mode 100644 index 000000000..45e023695 --- /dev/null +++ b/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts | |||
@@ -0,0 +1,39 @@ | |||
1 | import { Directive, EventEmitter, HostListener, Output } from '@angular/core' | ||
2 | |||
3 | @Directive({ | ||
4 | selector: '[timestampRouteTransformer]' | ||
5 | }) | ||
6 | export class TimestampRouteTransformerDirective { | ||
7 | @Output() timestampClicked = new EventEmitter<number>() | ||
8 | |||
9 | @HostListener('click', ['$event']) | ||
10 | public onClick ($event: Event) { | ||
11 | const target = $event.target as HTMLLinkElement | ||
12 | |||
13 | if (target.hasAttribute('href') !== true) return | ||
14 | |||
15 | const ngxLink = document.createElement('a') | ||
16 | ngxLink.href = target.getAttribute('href') | ||
17 | |||
18 | // we only care about reflective links | ||
19 | if (ngxLink.host !== window.location.host) return | ||
20 | |||
21 | const ngxLinkParams = new URLSearchParams(ngxLink.search) | ||
22 | if (ngxLinkParams.has('start') !== true) return | ||
23 | |||
24 | const separators = ['h', 'm', 's'] | ||
25 | const start = ngxLinkParams | ||
26 | .get('start') | ||
27 | .match(new RegExp('(\\d{1,9}[' + separators.join('') + '])','g')) // match digits before any given separator | ||
28 | .map(t => { | ||
29 | if (t.includes('h')) return parseInt(t, 10) * 3600 | ||
30 | if (t.includes('m')) return parseInt(t, 10) * 60 | ||
31 | return parseInt(t, 10) | ||
32 | }) | ||
33 | .reduce((acc, t) => acc + t) | ||
34 | |||
35 | this.timestampClicked.emit(start) | ||
36 | |||
37 | $event.preventDefault() | ||
38 | } | ||
39 | } | ||
diff --git a/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts b/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts new file mode 100644 index 000000000..4b6767415 --- /dev/null +++ b/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | import { Pipe, PipeTransform } from '@angular/core' | ||
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
3 | |||
4 | @Pipe({ | ||
5 | name: 'myVideoDurationFormatter' | ||
6 | }) | ||
7 | export class VideoDurationPipe implements PipeTransform { | ||
8 | |||
9 | constructor (private i18n: I18n) { | ||
10 | |||
11 | } | ||
12 | |||
13 | transform (value: number): string { | ||
14 | const hours = Math.floor(value / 3600) | ||
15 | const minutes = Math.floor((value % 3600) / 60) | ||
16 | const seconds = value % 60 | ||
17 | |||
18 | if (hours > 0) { | ||
19 | return this.i18n('{{hours}} h {{minutes}} min {{seconds}} sec', { hours, minutes, seconds }) | ||
20 | } | ||
21 | |||
22 | if (minutes > 0) { | ||
23 | return this.i18n('{{minutes}} min {{seconds}} sec', { minutes, seconds }) | ||
24 | } | ||
25 | |||
26 | return this.i18n('{{seconds}} sec', { seconds }) | ||
27 | } | ||
28 | } | ||
diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts index 827c34d41..2c21be643 100644 --- a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts +++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts | |||
@@ -1,15 +1,10 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | ||
3 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | ||
4 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' | ||
5 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
6 | import { UserService } from '@app/shared' | 3 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' |
7 | import { AuthService, Notifier } from '@app/core' | 4 | import { peertubeLocalStorage, peertubeSessionStorage } from '@app/helpers/peertube-web-storage' |
8 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 5 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
9 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' | ||
10 | import { peertubeLocalStorage, peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage' | ||
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
12 | import { SessionStorageService, LocalStorageService } from '@app/shared/misc/storage.service' | 7 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' |
13 | 8 | ||
14 | @Component({ | 9 | @Component({ |
15 | selector: 'my-video-watch-playlist', | 10 | selector: 'my-video-watch-playlist', |
diff --git a/client/src/app/videos/+video-watch/video-watch-routing.module.ts b/client/src/app/videos/+video-watch/video-watch-routing.module.ts index ce9250bdc..d8fecb87d 100644 --- a/client/src/app/videos/+video-watch/video-watch-routing.module.ts +++ b/client/src/app/videos/+video-watch/video-watch-routing.module.ts | |||
@@ -1,8 +1,6 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | |||
4 | import { MetaGuard } from '@ngx-meta/core' | 3 | import { MetaGuard } from '@ngx-meta/core' |
5 | |||
6 | import { VideoWatchComponent } from './video-watch.component' | 4 | import { VideoWatchComponent } from './video-watch.component' |
7 | 5 | ||
8 | const videoWatchRoutes: Routes = [ | 6 | const videoWatchRoutes: Routes = [ |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index df0c1058c..5b0b34c80 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -1,41 +1,33 @@ | |||
1 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | ||
2 | import { forkJoin, Observable, Subscription } from 'rxjs' | ||
1 | import { catchError } from 'rxjs/operators' | 3 | import { catchError } from 'rxjs/operators' |
4 | import { PlatformLocation } from '@angular/common' | ||
2 | import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' | 5 | import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 6 | import { ActivatedRoute, Router } from '@angular/router' |
7 | import { AuthService, AuthUser, ConfirmService, MarkdownService, Notifier, RestExtractor, ServerService, UserService } from '@app/core' | ||
8 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
4 | import { RedirectService } from '@app/core/routing/redirect.service' | 9 | import { RedirectService } from '@app/core/routing/redirect.service' |
5 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' | 10 | import { isXPercentInViewport, peertubeLocalStorage, scrollToTop } from '@app/helpers' |
6 | import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' | 11 | import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main' |
12 | import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' | ||
13 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | ||
7 | import { MetaService } from '@ngx-meta/core' | 14 | import { MetaService } from '@ngx-meta/core' |
8 | import { AuthUser, Notifier, ServerService } from '@app/core' | ||
9 | import { forkJoin, Observable, Subscription } from 'rxjs' | ||
10 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | ||
11 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' | ||
12 | import { AuthService, ConfirmService } from '../../core' | ||
13 | import { RestExtractor, UserService } from '../../shared' | ||
14 | import { VideoDetails } from '../../shared/video/video-details.model' | ||
15 | import { VideoService } from '../../shared/video/video.service' | ||
16 | import { VideoShareComponent } from './modal/video-share.component' | ||
17 | import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' | ||
18 | import { I18n } from '@ngx-translate/i18n-polyfill' | 15 | import { I18n } from '@ngx-translate/i18n-polyfill' |
19 | import { environment } from '../../../environments/environment' | 16 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' |
20 | import { VideoCaptionService } from '@app/shared/video-caption' | 17 | import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' |
21 | import { MarkdownService } from '@app/shared/renderer' | ||
22 | import { | 18 | import { |
23 | videojs, | ||
24 | CustomizationOptions, | 19 | CustomizationOptions, |
25 | P2PMediaLoaderOptions, | 20 | P2PMediaLoaderOptions, |
26 | PeertubePlayerManager, | 21 | PeertubePlayerManager, |
27 | PeertubePlayerManagerOptions, | 22 | PeertubePlayerManagerOptions, |
28 | PlayerMode | 23 | PlayerMode, |
24 | videojs | ||
29 | } from '../../../assets/player/peertube-player-manager' | 25 | } from '../../../assets/player/peertube-player-manager' |
30 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | ||
31 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | ||
32 | import { Video } from '@app/shared/video/video.model' | ||
33 | import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' | 26 | import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' |
34 | import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' | 27 | import { environment } from '../../../environments/environment' |
35 | import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' | 28 | import { VideoShareComponent } from './modal/video-share.component' |
36 | import { HooksService } from '@app/core/plugins/hooks.service' | 29 | import { VideoSupportComponent } from './modal/video-support.component' |
37 | import { PlatformLocation } from '@angular/common' | 30 | import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' |
38 | import { scrollToTop, isXPercentInViewport } from '@app/shared/misc/utils' | ||
39 | 31 | ||
40 | @Component({ | 32 | @Component({ |
41 | selector: 'my-video-watch', | 33 | selector: 'my-video-watch', |
diff --git a/client/src/app/videos/+video-watch/video-watch.module.ts b/client/src/app/videos/+video-watch/video-watch.module.ts index 9b445269d..a1c54f065 100644 --- a/client/src/app/videos/+video-watch/video-watch.module.ts +++ b/client/src/app/videos/+video-watch/video-watch.module.ts | |||
@@ -1,26 +1,40 @@ | |||
1 | import { QRCodeModule } from 'angularx-qrcode' | ||
1 | import { NgModule } from '@angular/core' | 2 | import { NgModule } from '@angular/core' |
2 | import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' | 3 | import { SharedFormModule } from '@app/shared/shared-forms' |
3 | import { SharedModule } from '../../shared' | 4 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' |
5 | import { SharedMainModule } from '@app/shared/shared-main' | ||
6 | import { SharedModerationModule } from '@app/shared/shared-moderation' | ||
7 | import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' | ||
8 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' | ||
9 | import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' | ||
10 | import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module' | ||
11 | import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap' | ||
4 | import { VideoCommentAddComponent } from './comment/video-comment-add.component' | 12 | import { VideoCommentAddComponent } from './comment/video-comment-add.component' |
5 | import { VideoCommentComponent } from './comment/video-comment.component' | 13 | import { VideoCommentComponent } from './comment/video-comment.component' |
6 | import { VideoCommentService } from './comment/video-comment.service' | 14 | import { VideoCommentService } from './comment/video-comment.service' |
7 | import { VideoCommentsComponent } from './comment/video-comments.component' | 15 | import { VideoCommentsComponent } from './comment/video-comments.component' |
8 | import { VideoShareComponent } from './modal/video-share.component' | 16 | import { VideoShareComponent } from './modal/video-share.component' |
17 | import { VideoSupportComponent } from './modal/video-support.component' | ||
18 | import { TimestampRouteTransformerDirective } from './timestamp-route-transformer.directive' | ||
19 | import { VideoDurationPipe } from './video-duration-formatter.pipe' | ||
20 | import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' | ||
9 | import { VideoWatchRoutingModule } from './video-watch-routing.module' | 21 | import { VideoWatchRoutingModule } from './video-watch-routing.module' |
10 | import { VideoWatchComponent } from './video-watch.component' | 22 | import { VideoWatchComponent } from './video-watch.component' |
11 | import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap' | ||
12 | import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module' | ||
13 | import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' | ||
14 | import { QRCodeModule } from 'angularx-qrcode' | ||
15 | import { TimestampRouteTransformerDirective } from '@app/shared/angular/timestamp-route-transformer.directive' | ||
16 | 23 | ||
17 | @NgModule({ | 24 | @NgModule({ |
18 | imports: [ | 25 | imports: [ |
19 | VideoWatchRoutingModule, | 26 | VideoWatchRoutingModule, |
20 | SharedModule, | ||
21 | NgbTooltipModule, | 27 | NgbTooltipModule, |
22 | QRCodeModule, | 28 | QRCodeModule, |
23 | RecommendationsModule | 29 | RecommendationsModule, |
30 | |||
31 | SharedMainModule, | ||
32 | SharedFormModule, | ||
33 | SharedVideoMiniatureModule, | ||
34 | SharedVideoPlaylistModule, | ||
35 | SharedUserSubscriptionModule, | ||
36 | SharedModerationModule, | ||
37 | SharedGlobalIconModule | ||
24 | ], | 38 | ], |
25 | 39 | ||
26 | declarations: [ | 40 | declarations: [ |
@@ -33,6 +47,8 @@ import { TimestampRouteTransformerDirective } from '@app/shared/angular/timestam | |||
33 | VideoCommentAddComponent, | 47 | VideoCommentAddComponent, |
34 | VideoCommentComponent, | 48 | VideoCommentComponent, |
35 | 49 | ||
50 | TimestampRouteTransformerDirective, | ||
51 | VideoDurationPipe, | ||
36 | TimestampRouteTransformerDirective | 52 | TimestampRouteTransformerDirective |
37 | ], | 53 | ], |
38 | 54 | ||
diff --git a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts index 0abf938b7..a376453bf 100644 --- a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts +++ b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts | |||
@@ -1,15 +1,13 @@ | |||
1 | import { Observable, of } from 'rxjs' | 1 | import { Observable, of } from 'rxjs' |
2 | import { map, switchMap } from 'rxjs/operators' | 2 | import { map, switchMap } from 'rxjs/operators' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService, UserService } from '@app/core' |
5 | import { AdvancedSearch } from '@app/search/advanced-search.model' | 5 | import { AdvancedSearch } from '@app/search/advanced-search.model' |
6 | import { SearchService } from '@app/search/search.service' | 6 | import { SearchService } from '@app/search/search.service' |
7 | import { UserService } from '@app/shared' | 7 | import { Video, VideoService } from '@app/shared/shared-main' |
8 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
9 | import { Video } from '@app/shared/video/video.model' | ||
10 | import { VideoService } from '@app/shared/video/video.service' | ||
11 | import { RecommendationService } from '@app/videos/recommendations/recommendations.service' | ||
12 | import { ServerConfig } from '@shared/models' | 8 | import { ServerConfig } from '@shared/models' |
9 | import { RecommendationInfo } from './recommendation-info.model' | ||
10 | import { RecommendationService } from './recommendations.service' | ||
13 | 11 | ||
14 | /** | 12 | /** |
15 | * Provides "recommendations" by providing the most recently uploaded videos. | 13 | * Provides "recommendations" by providing the most recently uploaded videos. |
diff --git a/client/src/app/videos/recommendations/recommendation-info.model.ts b/client/src/app/videos/recommendations/recommendation-info.model.ts new file mode 100644 index 000000000..0233563bb --- /dev/null +++ b/client/src/app/videos/recommendations/recommendation-info.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface RecommendationInfo { | ||
2 | uuid: string | ||
3 | tags?: string[] | ||
4 | } | ||
diff --git a/client/src/app/videos/recommendations/recommendations.module.ts b/client/src/app/videos/recommendations/recommendations.module.ts index 3e279cc29..03cc272ca 100644 --- a/client/src/app/videos/recommendations/recommendations.module.ts +++ b/client/src/app/videos/recommendations/recommendations.module.ts | |||
@@ -1,16 +1,21 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { InputSwitchModule } from 'primeng/inputswitch' | 1 | import { InputSwitchModule } from 'primeng/inputswitch' |
3 | import { RecommendedVideosComponent } from '@app/videos/recommendations/recommended-videos.component' | ||
4 | import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' | ||
5 | import { CommonModule } from '@angular/common' | 2 | import { CommonModule } from '@angular/common' |
6 | import { SharedModule } from '@app/shared' | 3 | import { NgModule } from '@angular/core' |
7 | import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' | 4 | import { SharedMainModule } from '@app/shared/shared-main' |
5 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' | ||
6 | import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' | ||
7 | import { RecentVideosRecommendationService } from './recent-videos-recommendation.service' | ||
8 | import { RecommendedVideosComponent } from './recommended-videos.component' | ||
9 | import { RecommendedVideosStore } from './recommended-videos.store' | ||
8 | 10 | ||
9 | @NgModule({ | 11 | @NgModule({ |
10 | imports: [ | 12 | imports: [ |
13 | CommonModule, | ||
11 | InputSwitchModule, | 14 | InputSwitchModule, |
12 | SharedModule, | 15 | |
13 | CommonModule | 16 | SharedMainModule, |
17 | SharedVideoPlaylistModule, | ||
18 | SharedVideoMiniatureModule | ||
14 | ], | 19 | ], |
15 | declarations: [ | 20 | declarations: [ |
16 | RecommendedVideosComponent | 21 | RecommendedVideosComponent |
diff --git a/client/src/app/videos/recommendations/recommendations.service.ts b/client/src/app/videos/recommendations/recommendations.service.ts index a547e289d..1d79d35f6 100644 --- a/client/src/app/videos/recommendations/recommendations.service.ts +++ b/client/src/app/videos/recommendations/recommendations.service.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Video } from '@app/shared/video/video.model' | ||
2 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
3 | import { Observable } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { Video } from '@app/shared/shared-main' | ||
3 | import { RecommendationInfo } from './recommendation-info.model' | ||
4 | 4 | ||
5 | export interface RecommendationService { | 5 | export interface RecommendationService { |
6 | getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> | 6 | getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> |
diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts index a6f3bce3d..016975341 100644 --- a/client/src/app/videos/recommendations/recommended-videos.component.ts +++ b/client/src/app/videos/recommendations/recommended-videos.component.ts | |||
@@ -1,15 +1,12 @@ | |||
1 | import { Observable } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier, SessionStorageService, User, UserService } from '@app/core' |
4 | import { User } from '@app/shared' | 4 | import { Video } from '@app/shared/shared-main' |
5 | import { SessionStorageService } from '@app/shared/misc/storage.service' | 5 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' |
6 | import { UserService } from '@app/shared/users/user.service' | 6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' |
7 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | ||
8 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
9 | import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' | ||
10 | import { Video } from '@app/shared/video/video.model' | ||
11 | import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' | ||
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { RecommendationInfo } from './recommendation-info.model' | ||
9 | import { RecommendedVideosStore } from './recommended-videos.store' | ||
13 | 10 | ||
14 | @Component({ | 11 | @Component({ |
15 | selector: 'my-recommended-videos', | 12 | selector: 'my-recommended-videos', |
diff --git a/client/src/app/videos/recommendations/recommended-videos.store.ts b/client/src/app/videos/recommendations/recommended-videos.store.ts index 858ec3a27..8c3fb6480 100644 --- a/client/src/app/videos/recommendations/recommended-videos.store.ts +++ b/client/src/app/videos/recommendations/recommended-videos.store.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { Inject, Injectable } from '@angular/core' | ||
2 | import { Observable, ReplaySubject } from 'rxjs' | 1 | import { Observable, ReplaySubject } from 'rxjs' |
3 | import { Video } from '@app/shared/video/video.model' | ||
4 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
5 | import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' | ||
6 | import { RecommendationService } from '@app/videos/recommendations/recommendations.service' | ||
7 | import { map, shareReplay, switchMap, take } from 'rxjs/operators' | 2 | import { map, shareReplay, switchMap, take } from 'rxjs/operators' |
3 | import { Inject, Injectable } from '@angular/core' | ||
4 | import { Video } from '@app/shared/shared-main' | ||
5 | import { RecentVideosRecommendationService } from './recent-videos-recommendation.service' | ||
6 | import { RecommendationInfo } from './recommendation-info.model' | ||
7 | import { RecommendationService } from './recommendations.service' | ||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * This store is intended to provide data for the RecommendedVideosComponent. | 10 | * This store is intended to provide data for the RecommendedVideosComponent. |
@@ -20,7 +20,7 @@ export class RecommendedVideosStore { | |||
20 | ) { | 20 | ) { |
21 | this.recommendations$ = this.requestsForLoad$$.pipe( | 21 | this.recommendations$ = this.requestsForLoad$$.pipe( |
22 | switchMap(requestedRecommendation => { | 22 | switchMap(requestedRecommendation => { |
23 | return recommendations.getRecommendations(requestedRecommendation) | 23 | return this.recommendations.getRecommendations(requestedRecommendation) |
24 | .pipe(take(1)) | 24 | .pipe(take(1)) |
25 | }), | 25 | }), |
26 | shareReplay() | 26 | shareReplay() |
diff --git a/client/src/app/videos/video-list/index.ts b/client/src/app/videos/video-list/index.ts index b367110ae..af1bd58b7 100644 --- a/client/src/app/videos/video-list/index.ts +++ b/client/src/app/videos/video-list/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './overview' | ||
1 | export * from './video-local.component' | 2 | export * from './video-local.component' |
2 | export * from './video-recently-added.component' | 3 | export * from './video-recently-added.component' |
3 | export * from './video-trending.component' | 4 | export * from './video-trending.component' |
diff --git a/client/src/app/videos/video-list/overview/index.ts b/client/src/app/videos/video-list/overview/index.ts new file mode 100644 index 000000000..e6cfa4802 --- /dev/null +++ b/client/src/app/videos/video-list/overview/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './overview.service' | ||
2 | export * from './video-overview.component' | ||
3 | export * from './videos-overview.model' | ||
diff --git a/client/src/app/videos/video-list/overview/overview.service.ts b/client/src/app/videos/video-list/overview/overview.service.ts new file mode 100644 index 000000000..4458454d5 --- /dev/null +++ b/client/src/app/videos/video-list/overview/overview.service.ts | |||
@@ -0,0 +1,78 @@ | |||
1 | import { forkJoin, Observable, of } from 'rxjs' | ||
2 | import { catchError, map, switchMap, tap } from 'rxjs/operators' | ||
3 | import { HttpClient, HttpParams } from '@angular/common/http' | ||
4 | import { Injectable } from '@angular/core' | ||
5 | import { RestExtractor, ServerService } from '@app/core' | ||
6 | import { immutableAssign } from '@app/helpers' | ||
7 | import { VideoService } from '@app/shared/shared-main' | ||
8 | import { peertubeTranslate, VideosOverview as VideosOverviewServer } from '@shared/models' | ||
9 | import { environment } from '../../../../environments/environment' | ||
10 | import { VideosOverview } from './videos-overview.model' | ||
11 | |||
12 | @Injectable() | ||
13 | export class OverviewService { | ||
14 | static BASE_OVERVIEW_URL = environment.apiUrl + '/api/v1/overviews/' | ||
15 | |||
16 | constructor ( | ||
17 | private authHttp: HttpClient, | ||
18 | private restExtractor: RestExtractor, | ||
19 | private videosService: VideoService, | ||
20 | private serverService: ServerService | ||
21 | ) {} | ||
22 | |||
23 | getVideosOverview (page: number): Observable<VideosOverview> { | ||
24 | let params = new HttpParams() | ||
25 | params = params.append('page', page + '') | ||
26 | |||
27 | return this.authHttp | ||
28 | .get<VideosOverviewServer>(OverviewService.BASE_OVERVIEW_URL + 'videos', { params }) | ||
29 | .pipe( | ||
30 | switchMap(serverVideosOverview => this.updateVideosOverview(serverVideosOverview)), | ||
31 | catchError(err => this.restExtractor.handleError(err)) | ||
32 | ) | ||
33 | } | ||
34 | |||
35 | private updateVideosOverview (serverVideosOverview: VideosOverviewServer): Observable<VideosOverview> { | ||
36 | const observables: Observable<any>[] = [] | ||
37 | const videosOverviewResult: VideosOverview = { | ||
38 | tags: [], | ||
39 | categories: [], | ||
40 | channels: [] | ||
41 | } | ||
42 | |||
43 | // Build videos objects | ||
44 | for (const key of Object.keys(serverVideosOverview)) { | ||
45 | for (const object of serverVideosOverview[ key ]) { | ||
46 | observables.push( | ||
47 | of(object.videos) | ||
48 | .pipe( | ||
49 | switchMap(videos => this.videosService.extractVideos({ total: 0, data: videos })), | ||
50 | map(result => result.data), | ||
51 | tap(videos => { | ||
52 | videosOverviewResult[key].push(immutableAssign(object, { videos })) | ||
53 | }) | ||
54 | ) | ||
55 | ) | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (observables.length === 0) return of(videosOverviewResult) | ||
60 | |||
61 | return forkJoin(observables) | ||
62 | .pipe( | ||
63 | // Translate categories | ||
64 | switchMap(() => { | ||
65 | return this.serverService.getServerLocale() | ||
66 | .pipe( | ||
67 | tap(translations => { | ||
68 | for (const c of videosOverviewResult.categories) { | ||
69 | c.category.label = peertubeTranslate(c.category.label, translations) | ||
70 | } | ||
71 | }) | ||
72 | ) | ||
73 | }), | ||
74 | map(() => videosOverviewResult) | ||
75 | ) | ||
76 | } | ||
77 | |||
78 | } | ||
diff --git a/client/src/app/videos/video-list/video-overview.component.html b/client/src/app/videos/video-list/overview/video-overview.component.html index ca986c634..ca986c634 100644 --- a/client/src/app/videos/video-list/video-overview.component.html +++ b/client/src/app/videos/video-list/overview/video-overview.component.html | |||
diff --git a/client/src/app/videos/video-list/video-overview.component.scss b/client/src/app/videos/video-list/overview/video-overview.component.scss index c1d10188a..c1d10188a 100644 --- a/client/src/app/videos/video-list/video-overview.component.scss +++ b/client/src/app/videos/video-list/overview/video-overview.component.scss | |||
diff --git a/client/src/app/videos/video-list/video-overview.component.ts b/client/src/app/videos/video-list/overview/video-overview.component.ts index 8ff8400db..b3be1d7b5 100644 --- a/client/src/app/videos/video-list/video-overview.component.ts +++ b/client/src/app/videos/video-list/overview/video-overview.component.ts | |||
@@ -1,11 +1,9 @@ | |||
1 | import { Subject } from 'rxjs' | 1 | import { Subject } from 'rxjs' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { Notifier } from '@app/core' | 3 | import { Notifier, ScreenService, User, UserService } from '@app/core' |
4 | import { User, UserService } from '@app/shared' | 4 | import { Video } from '@app/shared/shared-main' |
5 | import { ScreenService } from '@app/shared/misc/screen.service' | 5 | import { OverviewService } from './overview.service' |
6 | import { OverviewService } from '@app/shared/overview' | 6 | import { VideosOverview } from './videos-overview.model' |
7 | import { VideosOverview } from '@app/shared/overview/videos-overview.model' | ||
8 | import { Video } from '@app/shared/video/video.model' | ||
9 | 7 | ||
10 | @Component({ | 8 | @Component({ |
11 | selector: 'my-video-overview', | 9 | selector: 'my-video-overview', |
diff --git a/client/src/app/videos/video-list/overview/videos-overview.model.ts b/client/src/app/videos/video-list/overview/videos-overview.model.ts new file mode 100644 index 000000000..6765ad9b7 --- /dev/null +++ b/client/src/app/videos/video-list/overview/videos-overview.model.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import { Video } from '@app/shared/shared-main' | ||
2 | import { VideoChannelSummary, VideoConstant, VideosOverview as VideosOverviewServer } from '@shared/models' | ||
3 | |||
4 | export class VideosOverview implements VideosOverviewServer { | ||
5 | channels: { | ||
6 | channel: VideoChannelSummary | ||
7 | videos: Video[] | ||
8 | }[] | ||
9 | |||
10 | categories: { | ||
11 | category: VideoConstant<number> | ||
12 | videos: Video[] | ||
13 | }[] | ||
14 | |||
15 | tags: { | ||
16 | tag: string | ||
17 | videos: Video[] | ||
18 | }[] | ||
19 | [key: string]: any | ||
20 | } | ||
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 960523cd7..b4c71ac49 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -1,23 +1,17 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { AuthService } from '../../core/auth' | ||
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
6 | import { VideoSortField } from '../../shared/video/sort-field.type' | ||
7 | import { VideoService } from '../../shared/video/video.service' | ||
8 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' | ||
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
11 | import { UserRight } from '../../../../../shared/models/users' | ||
12 | import { Notifier, ServerService } from '@app/core' | ||
13 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
14 | import { UserService } from '@app/shared' | 5 | import { immutableAssign } from '@app/helpers' |
15 | import { LocalStorageService } from '@app/shared/misc/storage.service' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { UserRight, VideoFilter, VideoSortField } from '@shared/models' | ||
16 | 10 | ||
17 | @Component({ | 11 | @Component({ |
18 | selector: 'my-videos-local', | 12 | selector: 'my-videos-local', |
19 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 13 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], |
20 | templateUrl: '../../shared/video/abstract-video-list.html' | 14 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' |
21 | }) | 15 | }) |
22 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { | 16 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { |
23 | titlePage: string | 17 | titlePage: string |
diff --git a/client/src/app/videos/video-list/video-most-liked.component.ts b/client/src/app/videos/video-list/video-most-liked.component.ts index cc91a2330..ca14851bb 100644 --- a/client/src/app/videos/video-list/video-most-liked.component.ts +++ b/client/src/app/videos/video-list/video-most-liked.component.ts | |||
@@ -1,21 +1,17 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { AuthService } from '../../core/auth' | ||
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
6 | import { VideoSortField } from '../../shared/video/sort-field.type' | ||
7 | import { VideoService } from '../../shared/video/video.service' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
10 | import { Notifier, ServerService } from '@app/core' | ||
11 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
12 | import { UserService } from '@app/shared' | 5 | import { immutableAssign } from '@app/helpers' |
13 | import { LocalStorageService } from '@app/shared/misc/storage.service' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoSortField } from '@shared/models' | ||
14 | 10 | ||
15 | @Component({ | 11 | @Component({ |
16 | selector: 'my-videos-most-liked', | 12 | selector: 'my-videos-most-liked', |
17 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 13 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], |
18 | templateUrl: '../../shared/video/abstract-video-list.html' | 14 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' |
19 | }) | 15 | }) |
20 | export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { | 16 | export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { |
21 | titlePage: string | 17 | titlePage: string |
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index 9f57a61e3..c9395133f 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts | |||
@@ -1,21 +1,17 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { AuthService } from '../../core/auth' | ||
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
6 | import { VideoSortField } from '../../shared/video/sort-field.type' | ||
7 | import { VideoService } from '../../shared/video/video.service' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
10 | import { Notifier, ServerService } from '@app/core' | ||
11 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
12 | import { UserService } from '@app/shared' | 5 | import { immutableAssign } from '@app/helpers' |
13 | import { LocalStorageService } from '@app/shared/misc/storage.service' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoSortField } from '@shared/models' | ||
14 | 10 | ||
15 | @Component({ | 11 | @Component({ |
16 | selector: 'my-videos-recently-added', | 12 | selector: 'my-videos-recently-added', |
17 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 13 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], |
18 | templateUrl: '../../shared/video/abstract-video-list.html' | 14 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' |
19 | }) | 15 | }) |
20 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { | 16 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { |
21 | titlePage: string | 17 | titlePage: string |
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index 62e0f4e69..10eab18de 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -1,21 +1,17 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { AuthService } from '../../core/auth' | ||
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
6 | import { VideoSortField } from '../../shared/video/sort-field.type' | ||
7 | import { VideoService } from '../../shared/video/video.service' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
10 | import { Notifier, ServerService } from '@app/core' | ||
11 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
12 | import { UserService } from '@app/shared' | 5 | import { immutableAssign } from '@app/helpers' |
13 | import { LocalStorageService } from '@app/shared/misc/storage.service' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoSortField } from '@shared/models' | ||
14 | 10 | ||
15 | @Component({ | 11 | @Component({ |
16 | selector: 'my-videos-trending', | 12 | selector: 'my-videos-trending', |
17 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 13 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], |
18 | templateUrl: '../../shared/video/abstract-video-list.html' | 14 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' |
19 | }) | 15 | }) |
20 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { | 16 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { |
21 | titlePage: string | 17 | titlePage: string |
diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts index 036fd8dcb..41ad9b277 100644 --- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts | |||
@@ -1,22 +1,18 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { AuthService } from '../../core/auth' | ||
5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
6 | import { VideoSortField } from '../../shared/video/sort-field.type' | ||
7 | import { VideoService } from '../../shared/video/video.service' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
10 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | ||
11 | import { Notifier, ServerService } from '@app/core' | ||
12 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
13 | import { UserService } from '@app/shared' | 5 | import { immutableAssign } from '@app/helpers' |
14 | import { LocalStorageService } from '@app/shared/misc/storage.service' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { UserSubscriptionService } from '@app/shared/shared-user-subscription' | ||
8 | import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature' | ||
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | import { VideoSortField } from '@shared/models' | ||
15 | 11 | ||
16 | @Component({ | 12 | @Component({ |
17 | selector: 'my-videos-user-subscriptions', | 13 | selector: 'my-videos-user-subscriptions', |
18 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 14 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], |
19 | templateUrl: '../../shared/video/abstract-video-list.html' | 15 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' |
20 | }) | 16 | }) |
21 | export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { | 17 | export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { |
22 | titlePage: string | 18 | titlePage: string |
@@ -34,6 +30,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
34 | protected userService: UserService, | 30 | protected userService: UserService, |
35 | protected screenService: ScreenService, | 31 | protected screenService: ScreenService, |
36 | protected storageService: LocalStorageService, | 32 | protected storageService: LocalStorageService, |
33 | private userSubscription: UserSubscriptionService, | ||
37 | private videoService: VideoService, | 34 | private videoService: VideoService, |
38 | private hooks: HooksService | 35 | private hooks: HooksService |
39 | ) { | 36 | ) { |
@@ -64,7 +61,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
64 | } | 61 | } |
65 | 62 | ||
66 | return this.hooks.wrapObsFun( | 63 | return this.hooks.wrapObsFun( |
67 | this.videoService.getUserSubscriptionVideos.bind(this.videoService), | 64 | this.userSubscription.getUserSubscriptionVideos.bind(this.userSubscription), |
68 | params, | 65 | params, |
69 | 'common', | 66 | 'common', |
70 | 'filter:api.user-subscriptions-videos.videos.list.params', | 67 | 'filter:api.user-subscriptions-videos.videos.list.params', |
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts index 11a087d0a..16b65be63 100644 --- a/client/src/app/videos/videos-routing.module.ts +++ b/client/src/app/videos/videos-routing.module.ts | |||
@@ -6,8 +6,8 @@ import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.c | |||
6 | import { VideoTrendingComponent } from './video-list/video-trending.component' | 6 | import { VideoTrendingComponent } from './video-list/video-trending.component' |
7 | import { VideoMostLikedComponent } from './video-list/video-most-liked.component' | 7 | import { VideoMostLikedComponent } from './video-list/video-most-liked.component' |
8 | import { VideosComponent } from './videos.component' | 8 | import { VideosComponent } from './videos.component' |
9 | import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' | 9 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
10 | import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component' | 10 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' |
11 | 11 | ||
12 | const videosRoutes: Routes = [ | 12 | const videosRoutes: Routes = [ |
13 | { | 13 | { |
diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts index 95078a734..217e5bb50 100644 --- a/client/src/app/videos/videos.module.ts +++ b/client/src/app/videos/videos.module.ts | |||
@@ -1,18 +1,27 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' | 2 | import { SharedFormModule } from '@app/shared/shared-forms' |
3 | import { SharedModule } from '../shared' | 3 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' |
4 | import { SharedMainModule } from '@app/shared/shared-main' | ||
5 | import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' | ||
6 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' | ||
7 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | ||
8 | import { VideoLocalComponent } from './video-list/video-local.component' | ||
9 | import { VideoMostLikedComponent } from './video-list/video-most-liked.component' | ||
4 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 10 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
5 | import { VideoTrendingComponent } from './video-list/video-trending.component' | 11 | import { VideoTrendingComponent } from './video-list/video-trending.component' |
6 | import { VideoMostLikedComponent } from './video-list/video-most-liked.component' | 12 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
7 | import { VideosRoutingModule } from './videos-routing.module' | 13 | import { VideosRoutingModule } from './videos-routing.module' |
8 | import { VideosComponent } from './videos.component' | 14 | import { VideosComponent } from './videos.component' |
9 | import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' | ||
10 | import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component' | ||
11 | 15 | ||
12 | @NgModule({ | 16 | @NgModule({ |
13 | imports: [ | 17 | imports: [ |
14 | VideosRoutingModule, | 18 | VideosRoutingModule, |
15 | SharedModule | 19 | |
20 | SharedMainModule, | ||
21 | SharedFormModule, | ||
22 | SharedVideoMiniatureModule, | ||
23 | SharedUserSubscriptionModule, | ||
24 | SharedGlobalIconModule | ||
16 | ], | 25 | ], |
17 | 26 | ||
18 | declarations: [ | 27 | declarations: [ |