From 017c3dcadf71aef4c1a854e4867b77931747f06e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Oct 2018 14:35:55 +0200 Subject: Add ability to list all local videos on client --- .../app/videos/+video-edit/shared/video-edit.component.scss | 5 +++++ client/src/app/videos/video-list/video-local.component.ts | 12 ++++++++++++ 2 files changed, 17 insertions(+) (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.scss b/client/src/app/videos/+video-edit/shared/video-edit.component.scss index b039d7ad4..25db8e8ed 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.scss +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.scss @@ -5,6 +5,11 @@ @include peertube-select-container(auto); } +my-peertube-checkbox { + display: block; + margin-bottom: 1rem; +} + .video-edit { height: 100%; min-height: 300px; 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 c91c639ca..9d000cf2e 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts @@ -10,6 +10,7 @@ import { VideoService } from '../../shared/video/video.service' import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' +import { UserRight } from '../../../../../shared/models/users' @Component({ selector: 'my-videos-local', @@ -40,6 +41,11 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On ngOnInit () { super.ngOnInit() + if (this.authService.isLoggedIn()) { + const user = this.authService.getUser() + this.displayModerationBlock = user.hasRight(UserRight.SEE_ALL_VIDEOS) + } + this.generateSyndicationList() } @@ -56,4 +62,10 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On generateSyndicationList () { this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter, this.categoryOneOf) } + + toggleModerationDisplay () { + this.filter = this.filter === 'local' ? 'all-local' as 'all-local' : 'local' as 'local' + + this.reloadVideos() + } } -- cgit v1.2.3 From 244b4ae3973bc1511464a08158a123767f83179c Mon Sep 17 00:00:00 2001 From: BO41 Date: Thu, 18 Oct 2018 09:08:59 +0200 Subject: NoImplicitAny flag true (#1157) this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137 --- .../shared/video-caption-add-modal.component.ts | 4 ++-- .../app/videos/+video-edit/shared/video-edit.component.ts | 6 +++--- .../video-add-components/video-import-torrent.component.ts | 2 +- .../videos/+video-edit/video-add-components/video-send.ts | 2 +- .../video-add-components/video-upload.component.ts | 2 +- .../app/videos/+video-watch/comment/linkifier.service.ts | 6 +++--- .../+video-watch/comment/video-comment-add.component.ts | 2 +- .../videos/+video-watch/comment/video-comment.component.ts | 2 +- .../app/videos/+video-watch/comment/video-comment.model.ts | 2 +- .../videos/+video-watch/comment/video-comment.service.ts | 4 ++-- .../+video-watch/comment/video-comments.component.ts | 2 +- .../src/app/videos/+video-watch/video-watch.component.ts | 14 +++++++------- 12 files changed, 24 insertions(+), 24 deletions(-) (limited to 'client/src/app/videos') 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 07c33030a..a2c9237ad 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 @@ -19,7 +19,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni @ViewChild('modal') modal: ElementRef - videoCaptionLanguages = [] + videoCaptionLanguages: any = [] private openedModal: NgbModalRef private closingModal = false @@ -73,7 +73,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni this.hide() const languageId = this.form.value[ 'language' ] - const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) + const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId) this.captionAdded.emit({ language: languageObject, 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 eb9396d70..a56733e57 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 @@ -48,7 +48,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { calendarTimezone: string calendarDateFormat: string - private schedulerInterval + private schedulerInterval: any private firstPatchDone = false private initialVideoCaptions: string[] = [] @@ -77,13 +77,13 @@ export class VideoEditComponent implements OnInit, OnDestroy { } updateForm () { - const defaultValues = { + const defaultValues: any = { nsfw: 'false', commentsEnabled: 'true', waitTranscoding: 'true', tags: [] } - const obj = { + const obj: any = { name: this.videoValidatorsService.VIDEO_NAME, privacy: this.videoValidatorsService.VIDEO_PRIVACY, channelId: this.videoValidatorsService.VIDEO_CHANNEL, 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 0f7184ff8..9a50e2ab2 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 @@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('torrentfileInput') torrentfileInput + @ViewChild('torrentfileInput') torrentfileInput: any videoFileName: string magnetUri = '' 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 6d1bac3f2..cf9d47cbe 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 @@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo protected videoService: VideoService protected videoCaptionService: VideoCaptionService - abstract canDeactivate () + abstract canDeactivate (): any ngOnInit () { this.buildForm({}) 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 941dc5441..fa6ee0c23 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 @@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('videofileInput') videofileInput + @ViewChild('videofileInput') videofileInput: any // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY diff --git a/client/src/app/videos/+video-watch/comment/linkifier.service.ts b/client/src/app/videos/+video-watch/comment/linkifier.service.ts index 3f4072efd..9ad419a69 100644 --- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts +++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core' import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' -import * as linkify from 'linkifyjs' -import * as linkifyHtml from 'linkifyjs/html' +const linkify = require('linkifyjs') +const linkifyHtml = require('linkifyjs/html') @Injectable() export class LinkifierService { @@ -40,7 +40,7 @@ export class LinkifierService { const TT_UNDERSCORE = TT.UNDERSCORE const TT_DOT = TT.DOT - function MENTION (value) { + function MENTION (value: any) { this.v = value } 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 fb7de0e04..ba3c0398e 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 @@ -76,7 +76,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { this.formValidated() } - openVisitorModal (event) { + openVisitorModal (event: any) { if (this.user === null) { // we only open it for visitors // fixing ng-bootstrap ModalService and the "Expression Changed After It Has Been Checked" Error event.srcElement.blur() 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 e90008de9..982470786 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 @@ -26,7 +26,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { @Output() resetReply = new EventEmitter() sanitizedCommentHTML = '' - newParentComments = [] + newParentComments: any = [] constructor ( private linkifierService: LinkifierService, 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 fe591811e..824fb24c3 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 @@ -14,7 +14,7 @@ export class VideoComment implements VideoCommentServerModel { account: AccountInterface totalReplies: number by: string - accountAvatarUrl + accountAvatarUrl: string constructor (hash: VideoCommentServerModel) { this.id = hash.id 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 9bcb4b7de..7d9c2d0ad 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 @@ -32,7 +32,7 @@ export class VideoCommentService { return this.authHttp.post(url, normalizedComment) .pipe( - map(data => this.extractVideoComment(data['comment'])), + map((data: any) => this.extractVideoComment(data['comment'])), catchError(err => this.restExtractor.handleError(err)) ) } @@ -43,7 +43,7 @@ export class VideoCommentService { return this.authHttp.post(url, normalizedComment) .pipe( - map(data => this.extractVideoComment(data[ 'comment' ])), + map((data: any) => this.extractVideoComment(data[ 'comment' ])), catchError(err => this.restExtractor.handleError(err)) ) } 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 c864d82b7..4c1bdf2dd 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 @@ -35,7 +35,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { threadComments: { [ id: number ]: VideoCommentThreadTree } = {} threadLoading: { [ id: number ]: boolean } = {} - syndicationItems = [] + syndicationItems: any = [] private sub: Subscription 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 c5deddf05..ed5e723c9 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -7,7 +7,7 @@ import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-supp import { MetaService } from '@ngx-meta/core' import { NotificationsService } from 'angular2-notifications' import { forkJoin, Subscription } from 'rxjs' -import * as videojs from 'video.js' +const videojs = require('video.js') import 'videojs-hotkeys' import { Hotkey, HotkeysService } from 'angular2-hotkeys' import * as WebTorrent from 'webtorrent' @@ -45,7 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent - player: videojs.Player + player: any playerElement: HTMLVideoElement userRating: UserVideoRateType = null video: VideoDetails = null @@ -435,7 +435,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.zone.runOutsideAngular(async () => { videojs(this.playerElement, videojsOptions, function () { self.player = this - this.on('customError', (event, data) => self.handleError(data.err)) + this.on('customError', (data: any) => self.handleError(data.err)) addContextMenu(self.player, self.video.embedUrl) }) @@ -448,7 +448,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.checkUserRating() } - private setRating (nextRating) { + private setRating (nextRating: string) { let method switch (nextRating) { case 'like': @@ -466,11 +466,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { .subscribe( () => { // Update the video like attribute - this.updateVideoRating(this.userRating, nextRating) - this.userRating = nextRating + this.updateVideoRating(this.userRating, nextRating as VideoRateType) + this.userRating = nextRating as UserVideoRateType }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + (err: any) => this.notificationsService.error(this.i18n('Error'), err.message) ) } -- cgit v1.2.3 From c199c427d4ae586339822320f20f512a7a19dc3f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Oct 2018 14:35:31 +0200 Subject: Better typings --- .../shared/video-caption-add-modal.component.ts | 5 +++-- .../video-import-torrent.component.ts | 6 +++--- .../+video-edit/video-add-components/video-send.ts | 6 +++--- .../video-add-components/video-upload.component.ts | 6 +++--- .../app/videos/+video-watch/comment/linkifier.service.ts | 1 + .../+video-watch/comment/video-comment.component.ts | 2 +- .../videos/+video-watch/comment/video-comment.service.ts | 8 ++++---- .../+video-watch/comment/video-comments.component.html | 2 +- .../+video-watch/comment/video-comments.component.scss | 2 +- .../+video-watch/comment/video-comments.component.ts | 3 ++- .../app/videos/+video-watch/video-watch.component.scss | 2 +- .../src/app/videos/+video-watch/video-watch.component.ts | 16 +++++++++------- 12 files changed, 32 insertions(+), 27 deletions(-) (limited to 'client/src/app/videos') 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 a2c9237ad..796fbe531 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 @@ -5,6 +5,7 @@ import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validator import { ServerService } from '@app/core' import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' +import { VideoConstant } from '../../../../../../shared' @Component({ selector: 'my-video-caption-add-modal', @@ -19,7 +20,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni @ViewChild('modal') modal: ElementRef - videoCaptionLanguages: any = [] + videoCaptionLanguages: VideoConstant[] = [] private openedModal: NgbModalRef private closingModal = false @@ -73,7 +74,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni this.hide() const languageId = this.form.value[ 'language' ] - const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId) + const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) this.captionAdded.emit({ language: languageObject, 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 9a50e2ab2..e13c06ce9 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,4 +1,4 @@ -import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' +import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' import { NotificationsService } from 'angular2-notifications' import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' @@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('torrentfileInput') torrentfileInput: any + @ViewChild('torrentfileInput') torrentfileInput: ElementRef videoFileName: string magnetUri = '' @@ -64,7 +64,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca } fileChange () { - const torrentfile = this.torrentfileInput.nativeElement.files[0] as File + const torrentfile = this.torrentfileInput.nativeElement.files[0] if (!torrentfile) return this.importVideo(torrentfile) 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 cf9d47cbe..1bf22e1a9 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 @@ -3,7 +3,6 @@ import { LoadingBarService } from '@ngx-loading-bar/core' import { NotificationsService } from 'angular2-notifications' import { catchError, switchMap, tap } from 'rxjs/operators' import { FormReactive } from '@app/shared' -import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' import { VideoConstant, VideoPrivacy } from '../../../../../../shared' import { AuthService, ServerService } from '@app/core' import { VideoService } from '@app/shared/video/video.service' @@ -11,8 +10,9 @@ import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.m import { VideoCaptionService } from '@app/shared/video-caption' import { VideoEdit } from '@app/shared/video/video-edit.model' import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' +import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service' -export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { +export abstract class VideoSend extends FormReactive implements OnInit { userVideoChannels: { id: number, label: string, support: string }[] = [] videoPrivacies: VideoConstant[] = [] videoCaptions: VideoCaptionEdit[] = [] @@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo protected videoService: VideoService protected videoCaptionService: VideoCaptionService - abstract canDeactivate (): any + abstract canDeactivate (): CanComponentDeactivateResult ngOnInit () { this.buildForm({}) 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 fa6ee0c23..8e2d0deaf 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,5 +1,5 @@ import { HttpEventType, HttpResponse } from '@angular/common/http' -import { Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' +import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' import { LoadingBarService } from '@ngx-loading-bar/core' import { NotificationsService } from 'angular2-notifications' @@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('videofileInput') videofileInput: any + @ViewChild('videofileInput') videofileInput: ElementRef // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY @@ -110,7 +110,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy } uploadFirstStep () { - const videofile = this.videofileInput.nativeElement.files[0] as File + const videofile = this.videofileInput.nativeElement.files[0] if (!videofile) return // Cannot upload videos > 8GB for now diff --git a/client/src/app/videos/+video-watch/comment/linkifier.service.ts b/client/src/app/videos/+video-watch/comment/linkifier.service.ts index 9ad419a69..4f4ec1e5d 100644 --- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts +++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core' import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' +// FIXME: use @types/linkify when https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29682/files is merged? const linkify = require('linkifyjs') const linkifyHtml = require('linkifyjs/html') 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 982470786..00f0460a1 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 @@ -26,7 +26,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { @Output() resetReply = new EventEmitter() sanitizedCommentHTML = '' - newParentComments: any = [] + newParentComments: VideoComment[] = [] constructor ( private linkifierService: LinkifierService, 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 7d9c2d0ad..921447d5b 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 @@ -30,9 +30,9 @@ export class VideoCommentService { const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' const normalizedComment = lineFeedToHtml(comment, 'text') - return this.authHttp.post(url, normalizedComment) + return this.authHttp.post<{ comment: VideoCommentServerModel }>(url, normalizedComment) .pipe( - map((data: any) => this.extractVideoComment(data['comment'])), + map(data => this.extractVideoComment(data.comment)), catchError(err => this.restExtractor.handleError(err)) ) } @@ -41,9 +41,9 @@ export class VideoCommentService { const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId const normalizedComment = lineFeedToHtml(comment, 'text') - return this.authHttp.post(url, normalizedComment) + return this.authHttp.post<{ comment: VideoCommentServerModel }>(url, normalizedComment) .pipe( - map((data: any) => this.extractVideoComment(data[ 'comment' ])), + map(data => this.extractVideoComment(data.comment)), catchError(err => this.restExtractor.handleError(err)) ) } diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index 42e129d65..44016d8ad 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html @@ -4,7 +4,7 @@ Comments - + diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.scss b/client/src/app/videos/+video-watch/comment/video-comments.component.scss index dbb44c66c..575e331e4 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.scss @@ -23,7 +23,7 @@ margin-right: 0; } -my-video-feed { +my-feed { display: inline-block; margin-left: 5px; } 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 4c1bdf2dd..8850eccd8 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 @@ -12,6 +12,7 @@ import { VideoDetails } from '../../../shared/video/video-details.model' import { VideoComment } from './video-comment.model' import { VideoCommentService } from './video-comment.service' import { I18n } from '@ngx-translate/i18n-polyfill' +import { Syndication } from '@app/shared/video/syndication.model' @Component({ selector: 'my-video-comments', @@ -35,7 +36,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { threadComments: { [ id: number ]: VideoCommentThreadTree } = {} threadLoading: { [ id: number ]: boolean } = {} - syndicationItems: any = [] + syndicationItems: Syndication[] = [] private sub: Subscription diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index f31e4694a..2586a2204 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss @@ -162,7 +162,7 @@ $other-videos-width: 260px; } } - my-video-feed { + my-feed { margin-left: 5px; margin-top: 1px; } 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 ed5e723c9..65b974037 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -7,7 +7,9 @@ import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-supp import { MetaService } from '@ngx-meta/core' import { NotificationsService } from 'angular2-notifications' import { forkJoin, Subscription } from 'rxjs' -const videojs = require('video.js') +// FIXME: something weird with our path definition in tsconfig and typings +// @ts-ignore +import videojs from 'video.js' import 'videojs-hotkeys' import { Hotkey, HotkeysService } from 'angular2-hotkeys' import * as WebTorrent from 'webtorrent' @@ -45,7 +47,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent - player: any + player: videojs.Player playerElement: HTMLVideoElement userRating: UserVideoRateType = null video: VideoDetails = null @@ -435,7 +437,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.zone.runOutsideAngular(async () => { videojs(this.playerElement, videojsOptions, function () { self.player = this - this.on('customError', (data: any) => self.handleError(data.err)) + this.on('customError', ({ err }: { err: any }) => self.handleError(err)) addContextMenu(self.player, self.video.embedUrl) }) @@ -448,7 +450,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.checkUserRating() } - private setRating (nextRating: string) { + private setRating (nextRating: VideoRateType) { let method switch (nextRating) { case 'like': @@ -466,11 +468,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { .subscribe( () => { // Update the video like attribute - this.updateVideoRating(this.userRating, nextRating as VideoRateType) - this.userRating = nextRating as UserVideoRateType + this.updateVideoRating(this.userRating, nextRating) + this.userRating = nextRating }, - (err: any) => this.notificationsService.error(this.i18n('Error'), err.message) + (err: { message: string }) => this.notificationsService.error(this.i18n('Error'), err.message) ) } -- cgit v1.2.3 From 951ef8294e9eae8f0b42292059daf0c972dbc48f Mon Sep 17 00:00:00 2001 From: BO41 Date: Wed, 24 Oct 2018 21:50:18 +0200 Subject: add noImplicitThis flag (#1324) --- client/src/app/videos/+video-watch/comment/linkifier.service.ts | 2 +- client/src/app/videos/+video-watch/video-watch.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/+video-watch/comment/linkifier.service.ts b/client/src/app/videos/+video-watch/comment/linkifier.service.ts index 4f4ec1e5d..2529c9eaf 100644 --- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts +++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts @@ -41,7 +41,7 @@ export class LinkifierService { const TT_UNDERSCORE = TT.UNDERSCORE const TT_DOT = TT.DOT - function MENTION (value: any) { + function MENTION (this: any, value: any) { this.v = value } 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 65b974037..dda870905 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -435,7 +435,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { const self = this this.zone.runOutsideAngular(async () => { - videojs(this.playerElement, videojsOptions, function () { + videojs(this.playerElement, videojsOptions, function (this: videojs.Player) { self.player = this this.on('customError', ({ err }: { err: any }) => self.handleError(err)) -- cgit v1.2.3 From 5c6d985faeef1d6793d3f44ca6374f1a9b722806 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 14 Nov 2018 15:01:28 +0100 Subject: Check activities host --- client/src/app/videos/+video-watch/video-watch.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos') 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 dda870905..d0151ceb1 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -450,7 +450,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.checkUserRating() } - private setRating (nextRating: VideoRateType) { + private setRating (nextRating: UserVideoRateType) { let method switch (nextRating) { case 'like': @@ -476,7 +476,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ) } - private updateVideoRating (oldRating: UserVideoRateType, newRating: VideoRateType) { + private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) { let likesToIncrement = 0 let dislikesToIncrement = 0 -- cgit v1.2.3 From 2fbe7f1933f4bd5de96e6428234e56965616120e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Nov 2018 09:24:56 +0100 Subject: Fix new Angular 7 issues --- .../app/videos/+video-watch/comment/video-comment-add.component.html | 2 +- .../src/app/videos/+video-watch/comment/video-comment-add.component.ts | 2 +- client/src/app/videos/+video-watch/video-watch.module.ts | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html index b58a56596..d8a7a78c4 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html @@ -3,7 +3,7 @@ Avatar
-