From 4ec25ae825f8dee44d948b38d8216f9a239ff7b3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Nov 2020 15:57:38 +0100 Subject: [PATCH] Refactor last PR --- .../+videos/+video-watch/video-watch.component.html | 8 ++------ .../app/+videos/+video-watch/video-watch.component.ts | 6 ------ client/src/app/shared/shared-main/video/video.model.ts | 10 ++++++++++ .../video-miniature.component.html | 2 +- .../video-miniature.component.ts | 6 ------ 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html index d74334b13..602214ac5 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html @@ -54,9 +54,7 @@
Published - + • {{ video.views | myNumberFormatter }} views viewers @@ -73,9 +71,7 @@
Published - + • {{ video.views | myNumberFormatter }} views viewers 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 bc047489e..66af9709d 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -219,12 +219,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { return $localize`You need to be logged in to rate this video.` } - getExactNumberOfViews () { - return (this.video.views >= 1000) - ? `${this.video.views} ${this.video.isLive ? $localize`viewers` : $localize`views`}` - : '' - } - showMoreDescription () { if (this.completeVideoDescription === undefined) { return this.loadCompleteDescription() diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 04e7bd717..adb6e884f 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -203,4 +203,14 @@ export class Video implements VideoServerModel { canBeDuplicatedBy (user: AuthUser) { return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES) } + + getExactNumberOfViews () { + if (this.views < 1000) return '' + + if (this.isLive) { + return $localize`${this.views} viewers` + } + + return $localize`${this.views} views` + } } diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html index b323002e3..395a4df97 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html @@ -26,7 +26,7 @@ - + {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}} diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index e59255cf8..cc5665ab1 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts @@ -190,12 +190,6 @@ export class VideoMiniatureComponent implements OnInit { return this.video.videoChannelAvatarUrl } - getExactNumberOfViews () { - return (this.video.views >= 1000 && this.displayOptions.views) - ? `${this.video.views} ${this.video.isLive ? $localize`viewers` : $localize`views`}` - : '' - } - loadActions () { if (this.displayVideoActions) this.showActions = true