diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:42:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-18 08:35:06 +0200 |
commit | 9df52d660feb722404be00a50f3c8a612bec1c15 (patch) | |
tree | dde52880fa012874d24c60f64eb596b0a789cc8b /client/src/app/+videos/+video-watch/shared | |
parent | adb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff) | |
download | PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip |
Migrate client to eslint
Diffstat (limited to 'client/src/app/+videos/+video-watch/shared')
10 files changed, 24 insertions, 20 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts index ac65f7260..71fb127f6 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts | |||
@@ -25,7 +25,7 @@ import { VideoCommentCreate } from '@shared/models' | |||
25 | @Component({ | 25 | @Component({ |
26 | selector: 'my-video-comment-add', | 26 | selector: 'my-video-comment-add', |
27 | templateUrl: './video-comment-add.component.html', | 27 | templateUrl: './video-comment-add.component.html', |
28 | styleUrls: ['./video-comment-add.component.scss'] | 28 | styleUrls: [ './video-comment-add.component.scss' ] |
29 | }) | 29 | }) |
30 | export class VideoCommentAddComponent extends FormReactive implements OnChanges, OnInit { | 30 | export class VideoCommentAddComponent extends FormReactive implements OnChanges, OnInit { |
31 | @Input() user: User | 31 | @Input() user: User |
@@ -64,7 +64,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
64 | for (const emojiMarkupName in emojiMarkupObjectList) { | 64 | for (const emojiMarkupName in emojiMarkupObjectList) { |
65 | if (emojiMarkupName) { | 65 | if (emojiMarkupName) { |
66 | const emoji = emojiMarkupObjectList[emojiMarkupName] | 66 | const emoji = emojiMarkupObjectList[emojiMarkupName] |
67 | emojiMarkupArrayList.push([emoji, emojiMarkupName]) | 67 | emojiMarkupArrayList.push([ emoji, emojiMarkupName ]) |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
@@ -91,7 +91,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
91 | // Not initialized yet | 91 | // Not initialized yet |
92 | if (!this.form) return | 92 | if (!this.form) return |
93 | 93 | ||
94 | if (changes.textValue && changes.textValue.currentValue && changes.textValue.currentValue !== changes.textValue.previousValue) { | 94 | if (changes.textValue?.currentValue && changes.textValue.currentValue !== changes.textValue.previousValue) { |
95 | this.patchTextValue(changes.textValue.currentValue, true) | 95 | this.patchTextValue(changes.textValue.currentValue, true) |
96 | } | 96 | } |
97 | } | 97 | } |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html index d8b944b35..d0e9bcd29 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.html | |||
@@ -29,7 +29,7 @@ | |||
29 | class="comment-html" | 29 | class="comment-html" |
30 | [innerHTML]="sanitizedCommentHTML" | 30 | [innerHTML]="sanitizedCommentHTML" |
31 | (timestampClicked)="handleTimestampClicked($event)" | 31 | (timestampClicked)="handleTimestampClicked($event)" |
32 | timestampRouteTransformer | 32 | myTimestampRouteTransformer |
33 | ></div> | 33 | ></div> |
34 | 34 | ||
35 | <div class="comment-actions"> | 35 | <div class="comment-actions"> |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts index f858f4750..5bbcffe82 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts | |||
@@ -10,7 +10,7 @@ import { User, UserRight } from '@shared/models' | |||
10 | @Component({ | 10 | @Component({ |
11 | selector: 'my-video-comment', | 11 | selector: 'my-video-comment', |
12 | templateUrl: './video-comment.component.html', | 12 | templateUrl: './video-comment.component.html', |
13 | styleUrls: ['./video-comment.component.scss'] | 13 | styleUrls: [ './video-comment.component.scss' ] |
14 | }) | 14 | }) |
15 | export class VideoCommentComponent implements OnInit, OnChanges { | 15 | export class VideoCommentComponent implements OnInit, OnChanges { |
16 | @ViewChild('commentReportModal') commentReportModal: CommentReportComponent | 16 | @ViewChild('commentReportModal') commentReportModal: CommentReportComponent |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts index 72866b874..17e0af3bc 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts | |||
@@ -9,7 +9,7 @@ import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/ | |||
9 | @Component({ | 9 | @Component({ |
10 | selector: 'my-video-comments', | 10 | selector: 'my-video-comments', |
11 | templateUrl: './video-comments.component.html', | 11 | templateUrl: './video-comments.component.html', |
12 | styleUrls: ['./video-comments.component.scss'] | 12 | styleUrls: [ './video-comments.component.scss' ] |
13 | }) | 13 | }) |
14 | export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | 14 | export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { |
15 | @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef | 15 | @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef |
@@ -200,7 +200,11 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
200 | } | 200 | } |
201 | 201 | ||
202 | async onWantedToRedraft (commentToRedraft: VideoComment) { | 202 | async onWantedToRedraft (commentToRedraft: VideoComment) { |
203 | const confirm = await this.onWantedToDelete(commentToRedraft, $localize`Delete and re-draft`, $localize`Do you really want to delete and re-draft this comment?`) | 203 | const confirm = await this.onWantedToDelete( |
204 | commentToRedraft, | ||
205 | $localize`Delete and re-draft`, | ||
206 | $localize`Do you really want to delete and re-draft this comment?` | ||
207 | ) | ||
204 | 208 | ||
205 | if (confirm) { | 209 | if (confirm) { |
206 | this.inReplyToCommentId = commentToRedraft.inReplyToCommentId | 210 | this.inReplyToCommentId = commentToRedraft.inReplyToCommentId |
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts index 0072492ac..257d463b4 100644 --- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts | |||
@@ -23,7 +23,7 @@ export class VideoAlertComponent { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | hasVideoScheduledPublication () { | 25 | hasVideoScheduledPublication () { |
26 | return this.video && this.video.scheduledUpdate !== undefined | 26 | return this.video?.scheduledUpdate !== undefined |
27 | } | 27 | } |
28 | 28 | ||
29 | isWaitingForLive () { | 29 | isWaitingForLive () { |
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html index 57f682899..2cfaad8f6 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html | |||
@@ -3,7 +3,7 @@ | |||
3 | class="video-info-description-html" | 3 | class="video-info-description-html" |
4 | [innerHTML]="videoHTMLDescription" | 4 | [innerHTML]="videoHTMLDescription" |
5 | (timestampClicked)="onTimestampClicked($event)" | 5 | (timestampClicked)="onTimestampClicked($event)" |
6 | timestampRouteTransformer | 6 | myTimestampRouteTransformer |
7 | ></div> | 7 | ></div> |
8 | 8 | ||
9 | <div class="video-info-description-more" *ngIf="completeDescriptionShown === false && video.description?.length >= 250" (click)="showMoreDescription()"> | 9 | <div class="video-info-description-more" *ngIf="completeDescriptionShown === false && video.description?.length >= 250" (click)="showMoreDescription()"> |
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts index f0f7966b1..78b3af4a7 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts | |||
@@ -39,7 +39,7 @@ export class VideoWatchPlaylistComponent { | |||
39 | private notifier: Notifier, | 39 | private notifier: Notifier, |
40 | private videoPlaylist: VideoPlaylistService, | 40 | private videoPlaylist: VideoPlaylistService, |
41 | private localStorageService: LocalStorageService, | 41 | private localStorageService: LocalStorageService, |
42 | private sessionStorageService: SessionStorageService, | 42 | private sessionStorage: SessionStorageService, |
43 | private router: Router | 43 | private router: Router |
44 | ) { | 44 | ) { |
45 | // defaults to true | 45 | // defaults to true |
@@ -50,7 +50,7 @@ export class VideoWatchPlaylistComponent { | |||
50 | this.setAutoPlayNextVideoPlaylistSwitchText() | 50 | this.setAutoPlayNextVideoPlaylistSwitchText() |
51 | 51 | ||
52 | // defaults to false | 52 | // defaults to false |
53 | this.loopPlaylist = this.sessionStorageService.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' | 53 | this.loopPlaylist = this.sessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' |
54 | this.setLoopPlaylistSwitchText() | 54 | this.setLoopPlaylistSwitchText() |
55 | } | 55 | } |
56 | 56 | ||
@@ -145,7 +145,7 @@ export class VideoWatchPlaylistComponent { | |||
145 | 145 | ||
146 | const start = previous.startTimestamp | 146 | const start = previous.startTimestamp |
147 | const stop = previous.stopTimestamp | 147 | const stop = previous.stopTimestamp |
148 | this.router.navigate([],{ queryParams: { playlistPosition: previous.position, start, stop } }) | 148 | this.router.navigate([], { queryParams: { playlistPosition: previous.position, start, stop } }) |
149 | } | 149 | } |
150 | 150 | ||
151 | findPlaylistVideo (position: number, type: 'previous' | 'next'): VideoPlaylistElement { | 151 | findPlaylistVideo (position: number, type: 'previous' | 'next'): VideoPlaylistElement { |
@@ -163,7 +163,7 @@ export class VideoWatchPlaylistComponent { | |||
163 | } | 163 | } |
164 | 164 | ||
165 | const found = this.playlistElements.find(e => e.position === position) | 165 | const found = this.playlistElements.find(e => e.position === position) |
166 | if (found && found.video) return found | 166 | if (found?.video) return found |
167 | 167 | ||
168 | const newPosition = type === 'previous' | 168 | const newPosition = type === 'previous' |
169 | ? position - 1 | 169 | ? position - 1 |
@@ -178,7 +178,7 @@ export class VideoWatchPlaylistComponent { | |||
178 | 178 | ||
179 | const start = next.startTimestamp | 179 | const start = next.startTimestamp |
180 | const stop = next.stopTimestamp | 180 | const stop = next.stopTimestamp |
181 | this.router.navigate([],{ queryParams: { playlistPosition: next.position, start, stop } }) | 181 | this.router.navigate([], { queryParams: { playlistPosition: next.position, start, stop } }) |
182 | } | 182 | } |
183 | 183 | ||
184 | switchAutoPlayNextVideoPlaylist () { | 184 | switchAutoPlayNextVideoPlaylist () { |
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html index e1040fead..bbfcab2ae 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html | |||
@@ -20,7 +20,7 @@ | |||
20 | > | 20 | > |
21 | </my-video-miniature> | 21 | </my-video-miniature> |
22 | 22 | ||
23 | <hr *ngIf="!playlist && i == 0 && length > 1" /> | 23 | <hr *ngIf="!playlist && i === 0 && length > 1" /> |
24 | </ng-container> | 24 | </ng-container> |
25 | </ng-container> | 25 | </ng-container> |
26 | </div> | 26 | </div> |
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts index 7f3703c08..dfc296d15 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts | |||
@@ -51,7 +51,7 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
51 | } else { | 51 | } else { |
52 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | 52 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' |
53 | 53 | ||
54 | this.sessionStorageService.watch([UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO]).subscribe( | 54 | this.sessionStorageService.watch([ UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO ]).subscribe( |
55 | () => { | 55 | () => { |
56 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | 56 | this.autoPlayNextVideo = this.sessionStorageService.getItem(UserLocalStorageKeys.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' |
57 | } | 57 | } |
diff --git a/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts b/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts index 45e023695..91fe5bf5d 100644 --- a/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts +++ b/client/src/app/+videos/+video-watch/shared/timestamp-route-transformer.directive.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import { Directive, EventEmitter, HostListener, Output } from '@angular/core' | 1 | import { Directive, EventEmitter, HostListener, Output } from '@angular/core' |
2 | 2 | ||
3 | @Directive({ | 3 | @Directive({ |
4 | selector: '[timestampRouteTransformer]' | 4 | selector: '[myTimestampRouteTransformer]' |
5 | }) | 5 | }) |
6 | export class TimestampRouteTransformerDirective { | 6 | export class TimestampRouteTransformerDirective { |
7 | @Output() timestampClicked = new EventEmitter<number>() | 7 | @Output() timestampClicked = new EventEmitter<number>() |
8 | 8 | ||
9 | @HostListener('click', ['$event']) | 9 | @HostListener('click', [ '$event' ]) |
10 | public onClick ($event: Event) { | 10 | public onClick ($event: Event) { |
11 | const target = $event.target as HTMLLinkElement | 11 | const target = $event.target as HTMLLinkElement |
12 | 12 | ||
@@ -21,10 +21,10 @@ export class TimestampRouteTransformerDirective { | |||
21 | const ngxLinkParams = new URLSearchParams(ngxLink.search) | 21 | const ngxLinkParams = new URLSearchParams(ngxLink.search) |
22 | if (ngxLinkParams.has('start') !== true) return | 22 | if (ngxLinkParams.has('start') !== true) return |
23 | 23 | ||
24 | const separators = ['h', 'm', 's'] | 24 | const separators = [ 'h', 'm', 's' ] |
25 | const start = ngxLinkParams | 25 | const start = ngxLinkParams |
26 | .get('start') | 26 | .get('start') |
27 | .match(new RegExp('(\\d{1,9}[' + separators.join('') + '])','g')) // match digits before any given separator | 27 | .match(new RegExp('(\\d{1,9}[' + separators.join('') + '])', 'g')) // match digits before any given separator |
28 | .map(t => { | 28 | .map(t => { |
29 | if (t.includes('h')) return parseInt(t, 10) * 3600 | 29 | if (t.includes('h')) return parseInt(t, 10) * 3600 |
30 | if (t.includes('m')) return parseInt(t, 10) * 60 | 30 | if (t.includes('m')) return parseInt(t, 10) * 60 |