]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video/video.model.ts
Allow user to search through their watch history (#3576)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / video.model.ts
index 8e0e680209e3357d613a48643853f461a7bbac74..adb6e884f16c2066a2c6f9a9b31408807334b578 100644 (file)
@@ -1,6 +1,9 @@
 import { AuthUser } from '@app/core'
 import { User } from '@app/core/users/user.model'
 import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'
+import { Account } from '@app/shared/shared-main/account/account.model'
+import { Actor } from '@app/shared/shared-main/account/actor.model'
+import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model'
 import { peertubeTranslate } from '@shared/core-utils/i18n'
 import {
   Avatar,
@@ -12,7 +15,6 @@ import {
   VideoScheduleUpdate,
   VideoState
 } from '@shared/models'
-import { Account, Actor, VideoChannel } from '@app/shared/shared-main'
 
 export class Video implements VideoServerModel {
   byVideoChannel: string
@@ -201,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`
+  }
 }