ActivityPub-federated video streaming platform using P2P directly in your web browser
Automatically jump to the highlighted thread
Chocobozzzbf079b7bfd7f
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scssindex e586880fce..dbce744bf6 100644--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss@@ -28,7 +28,7 @@ form {.submit-comment {display: flex;- justify-content: end;+ justify-content: flex-end;button {@include peertube-button;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.htmlindex 7278f7e579..8871980e93 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@@ -3,7 +3,7 @@<div i18n class="title-page title-page-single">Comments</div>- <my-help+ <my-help*ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtmlcustomHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.name}}@{{video.account.host}}</strong> and find back the video. Direct commenting capabilities are being worked on in <a href='https://github.com/Chocobozzz/PeerTube/issues/224'>#224</a>."></my-help></div>@@ -24,8 +24,9 @@[autoLoading]="true"(nearOfBottom)="onNearOfBottom()">- <div *ngIf="highlightedThread" id="highlighted-comment">+ <div #commentHighlightBlock id="highlighted-comment"><my-video-comment+ *ngIf="highlightedThread"[comment]="highlightedThread"[video]="video"[inReplyToCommentId]="inReplyToCommentId"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.tsindex 72f66ff096..274c32d31b 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,4 +1,4 @@-import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'+import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild, ElementRef } from '@angular/core'import { ActivatedRoute } from '@angular/router'import { ConfirmService } from '@app/core'import { NotificationsService } from 'angular2-notifications'@@ -19,6 +19,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'styleUrls: ['./video-comments.component.scss']})export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {+ @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef@Input() video: VideoDetails@Input() user: User@@ -76,7 +77,17 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {this.threadComments[commentId] = resthis.threadLoading[commentId] = false- if (highlightThread) this.highlightedThread = new VideoComment(res.comment)+ if (highlightThread) {+ this.highlightedThread = new VideoComment(res.comment)++ // Scroll to the highlighted thread+ setTimeout(() => {+ // -60 because of the fixed header+ console.log(this.commentHighlightBlock.nativeElement.offsetTop)+ const scrollY = this.commentHighlightBlock.nativeElement.offsetTop - 60+ window.scroll(0, scrollY)+ }, 500)+ }},err => this.notificationsService.error(this.i18n('Error'), err.message)diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.tsindex 498542fff2..a760c03e85 100644--- a/client/src/app/videos/+video-watch/video-watch.component.ts+++ b/client/src/app/videos/+video-watch/video-watch.component.ts@@ -101,14 +101,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {)this.paramsSub = this.route.params.subscribe(routeParams => {- if (this.player) {- this.player.pause()- }-const uuid = routeParams[ 'uuid' ]// Video did not changeif (this.video && this.video.uuid === uuid) return++ if (this.player) this.player.pause()+// Video did changethis.videoService.getVideo(uuid)@@ -469,7 +468,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {}private isAutoplay () {- // True by default+ // We'll jump to the thread id, so do not play the video+ if (this.route.snapshot.params['threadId']) return false++ // Otherwise true by defaultif (!this.user) return true// Be sure the autoPlay is set to false