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 --- .../video-avatar-channel.component.html | 30 ++++-------- .../video-avatar-channel.component.scss | 56 +++++++++++----------- .../+video-watch/video-avatar-channel.component.ts | 1 - .../shared-actor-image/actor-avatar.component.ts | 2 +- .../shared/shared-main/account/account.model.ts | 9 ---- .../app/shared/shared-main/account/actor.model.ts | 1 - .../video-channel/video-channel.model.ts | 3 -- .../app/shared/shared-main/video/video.model.ts | 3 -- .../video-miniature.component.ts | 8 ---- .../shared-video-playlist/video-playlist.model.ts | 4 -- 10 files changed, 38 insertions(+), 79 deletions(-) diff --git a/client/src/app/+videos/+video-watch/video-avatar-channel.component.html b/client/src/app/+videos/+video-watch/video-avatar-channel.component.html index b8b5d7843..5f149cbd1 100644 --- a/client/src/app/+videos/+video-watch/video-avatar-channel.component.html +++ b/client/src/app/+videos/+video-watch/video-avatar-channel.component.html @@ -1,21 +1,11 @@ -
- - - Channel avatar - - - - - - - - - - Channel avatar - - - - - - +
+ + +
diff --git a/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss b/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss index 4998e85fa..20e32240c 100644 --- a/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss +++ b/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss @@ -1,44 +1,42 @@ @import '_mixins'; +@mixin main { + @include actor-avatar-size(35px); +} + +@mixin secondary { + height: 60%; + width: 60%; + position: absolute; + bottom: -5px; + right: -5px; + background-color: rgba(0, 0, 0, 0); +} + .wrapper { - $avatar-size: 35px; + @include actor-avatar-size(35px); - width: $avatar-size; - height: $avatar-size; position: relative; margin-right: 5px; margin-bottom: 5px; - &.avatar-sm { - width: 28px; - height: 28px; - margin-bottom: 3px; - } + &.generic-channel { + .account { + @include main(); + } - a { - @include disable-outline; + .channel { + display: none !important; + } } - a img { - height: 100%; - object-fit: cover; - position: absolute; - top:50%; - left:50%; - transform: translate(-50%,-50%); - border-radius: 5px; - - &:not(.channel-avatar) { - border-radius: 50%; + &:not(.generic-channel) { + .account { + @include secondary(); } - } - a:nth-of-type(2) img { - height: 60%; - width: 60%; - border: 2px solid pvar(--mainBackgroundColor); - transform: translateX(15%); - position: relative; - background-color: pvar(--mainBackgroundColor); + .channel { + @include main(); + } } } diff --git a/client/src/app/+videos/+video-watch/video-avatar-channel.component.ts b/client/src/app/+videos/+video-watch/video-avatar-channel.component.ts index 0b6e796df..63edd7bad 100644 --- a/client/src/app/+videos/+video-watch/video-avatar-channel.component.ts +++ b/client/src/app/+videos/+video-watch/video-avatar-channel.component.ts @@ -10,7 +10,6 @@ export class VideoAvatarChannelComponent implements OnInit { @Input() video: Video @Input() byAccount: string - @Input() size: 'md' | 'sm' = 'md' @Input() genericChannel: boolean channelLinkTitle = '' 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