From c6f8ca4d6596572de981162983bd02eb2613791d Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Tue, 31 May 2022 16:01:11 +0200 Subject: Added "total views" in the my channels list (#5007) * Added "total views" in the my channels list Implements https://github.com/Chocobozzz/PeerTube/issues/4331 * Fix lint * applied suggested change * updated openAPI spec for the use "withStats" when getting video channels * applied code change * removed GROUP BY in query * Fixed test --- .../src/app/shared/shared-main/video-channel/video-channel.model.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'client/src/app/shared/shared-main') diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts index 32376bf62..62bd94349 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts @@ -27,6 +27,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel { videosCount?: number viewsPerDay?: ViewsPerDate[] + totalViews?: number static GET_ACTOR_AVATAR_URL (actor: { avatars: { width: number, url?: string, path: string }[] }, size: number) { return Actor.GET_ACTOR_AVATAR_URL(actor, size) @@ -74,6 +75,10 @@ export class VideoChannel extends Actor implements ServerVideoChannel { this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) } + if (hash.totalViews !== null && hash.totalViews !== undefined) { + this.totalViews = hash.totalViews + } + if (hash.ownerAccount) { this.ownerAccount = hash.ownerAccount this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) -- cgit v1.2.3