From 7d026caf683e42fd57a243a3b52a5e4f476fbb4e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Apr 2021 15:59:46 +0200 Subject: Remove avatarUrl from models --- .../src/app/shared/shared-actor-image/actor-avatar.component.ts | 2 +- client/src/app/shared/shared-main/account/account.model.ts | 9 --------- client/src/app/shared/shared-main/account/actor.model.ts | 1 - .../app/shared/shared-main/video-channel/video-channel.model.ts | 3 --- client/src/app/shared/shared-main/video/video.model.ts | 3 --- .../shared/shared-video-miniature/video-miniature.component.ts | 8 -------- .../src/app/shared/shared-video-playlist/video-playlist.model.ts | 4 ---- 7 files changed, 1 insertion(+), 29 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts index 6bb3b65fa..71e020cba 100644 --- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts +++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts @@ -73,7 +73,7 @@ export class ActorAvatarComponent { get avatarUrl () { if (this.account) return Account.GET_ACTOR_AVATAR_URL(this.account) - if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.account) + if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.channel) return '' } diff --git a/client/src/app/shared/shared-main/account/account.model.ts b/client/src/app/shared/shared-main/account/account.model.ts index c90bafa5c..6d9f0ee65 100644 --- a/client/src/app/shared/shared-main/account/account.model.ts +++ b/client/src/app/shared/shared-main/account/account.model.ts @@ -24,8 +24,6 @@ export class Account extends Actor implements ServerAccount { constructor (hash: ServerAccount) { super(hash) - this.updateComputedAttributes() - this.displayName = hash.displayName this.description = hash.description this.userId = hash.userId @@ -40,16 +38,9 @@ export class Account extends Actor implements ServerAccount { updateAvatar (newAvatar: ActorImage) { this.avatar = newAvatar - - this.updateComputedAttributes() } resetAvatar () { this.avatar = null - this.avatarUrl = null - } - - private updateComputedAttributes () { - this.avatarUrl = Account.GET_ACTOR_AVATAR_URL(this) } } diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts index 4b036341f..6ba0bb09e 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts @@ -15,7 +15,6 @@ export abstract class Actor implements ServerActor { updatedAt: Date | string avatar: ActorImage - avatarUrl: string isLocal: boolean 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 548725e04..c40dd5311 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 @@ -18,7 +18,6 @@ export class VideoChannel extends Actor implements ServerVideoChannel { ownerAccount?: ServerAccount ownerBy?: string - ownerAvatarUrl?: string videosCount?: number @@ -67,7 +66,6 @@ export class VideoChannel extends Actor implements ServerVideoChannel { if (hash.ownerAccount) { this.ownerAccount = hash.ownerAccount this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) - this.ownerAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.ownerAccount) } this.updateComputedAttributes() @@ -94,7 +92,6 @@ export class VideoChannel extends Actor implements ServerVideoChannel { } updateComputedAttributes () { - this.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this) this.bannerUrl = VideoChannel.GET_ACTOR_BANNER_URL(this) } } 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 14c507295..526d10e32 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -20,8 +20,6 @@ export class Video implements VideoServerModel { byVideoChannel: string byAccount: string - videoChannelAvatarUrl: string - createdAt: Date updatedAt: Date publishedAt: Date @@ -143,7 +141,6 @@ export class Video implements VideoServerModel { this.byAccount = Actor.CREATE_BY_STRING(hash.account.name, hash.account.host) this.byVideoChannel = Actor.CREATE_BY_STRING(hash.channel.name, hash.channel.host) - this.videoChannelAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.channel) this.category.label = peertubeTranslate(this.category.label, translations) this.licence.label = peertubeTranslate(this.licence.label, translations) 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 8d66aaee2..d74b70d4c 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 @@ -180,14 +180,6 @@ export class VideoMiniatureComponent implements OnInit { return '' } - getAvatarUrl () { - if (this.displayOwnerAccount()) { - return this.video.account.avatar?.url - } - - return this.video.videoChannelAvatarUrl - } - loadActions () { if (this.displayVideoActions) this.showActions = true diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts index 9bec16d77..5b6ba9dbf 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts @@ -37,10 +37,8 @@ export class VideoPlaylist implements ServerVideoPlaylist { embedUrl: string ownerBy: string - ownerAvatarUrl: string videoChannelBy?: string - videoChannelAvatarUrl?: string private thumbnailVersion: number private originThumbnailUrl: string @@ -78,12 +76,10 @@ export class VideoPlaylist implements ServerVideoPlaylist { this.ownerAccount = hash.ownerAccount this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) - this.ownerAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.ownerAccount) if (hash.videoChannel) { this.videoChannel = hash.videoChannel this.videoChannelBy = Actor.CREATE_BY_STRING(hash.videoChannel.name, hash.videoChannel.host) - this.videoChannelAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.videoChannel) } this.privacy.label = peertubeTranslate(this.privacy.label, translations) -- cgit v1.2.3