Remove avatarUrl from models
This commit is contained in:
parent
746018f6b8
commit
7d026caf68
10 changed files with 39 additions and 80 deletions
client/src/app
+videos/+video-watch
video-avatar-channel.component.htmlvideo-avatar-channel.component.scssvideo-avatar-channel.component.ts
shared
shared-actor-image
shared-main
shared-video-miniature
shared-video-playlist
|
@ -1,21 +1,11 @@
|
|||
<div class="wrapper" [ngClass]="'avatar-' + size">
|
||||
<ng-container *ngIf="!isChannelAvatarNull() && !genericChannel">
|
||||
<a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
|
||||
<img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" class="channel-avatar" />
|
||||
</a>
|
||||
<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }">
|
||||
<my-actor-avatar
|
||||
class="channel" [channel]="video.channel"
|
||||
[internalHref]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle"
|
||||
></my-actor-avatar>
|
||||
|
||||
<my-actor-avatar [account]="video.account" [title]="accountLinkTitle" [internalHref]="[ '/accounts', video.byAccount ]"></my-actor-avatar>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!isChannelAvatarNull() && genericChannel">
|
||||
<my-actor-avatar [account]="video.account" [title]="accountLinkTitle" [internalHref]="[ '/accounts', video.byAccount ]"></my-actor-avatar>
|
||||
|
||||
<a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
|
||||
<img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" class="channel-avatar" />
|
||||
</a>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="isChannelAvatarNull()">
|
||||
<my-actor-avatar [account]="video.account" [title]="accountLinkTitle" [internalHref]="[ '/accounts', video.byAccount ]"></my-actor-avatar>
|
||||
</ng-container>
|
||||
<my-actor-avatar
|
||||
class="account" [account]="video.account"
|
||||
[internalHref]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
|
||||
</my-actor-avatar>
|
||||
</div>
|
||||
|
|
|
@ -1,44 +1,42 @@
|
|||
@import '_mixins';
|
||||
|
||||
.wrapper {
|
||||
$avatar-size: 35px;
|
||||
@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 {
|
||||
@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;
|
||||
}
|
||||
|
||||
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%;
|
||||
.channel {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
a:nth-of-type(2) img {
|
||||
height: 60%;
|
||||
width: 60%;
|
||||
border: 2px solid pvar(--mainBackgroundColor);
|
||||
transform: translateX(15%);
|
||||
position: relative;
|
||||
background-color: pvar(--mainBackgroundColor);
|
||||
&:not(.generic-channel) {
|
||||
.account {
|
||||
@include secondary();
|
||||
}
|
||||
|
||||
.channel {
|
||||
@include main();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ export class VideoAvatarChannelComponent implements OnInit {
|
|||
@Input() video: Video
|
||||
@Input() byAccount: string
|
||||
|
||||
@Input() size: 'md' | 'sm' = 'md'
|
||||
@Input() genericChannel: boolean
|
||||
|
||||
channelLinkTitle = ''
|
||||
|
|
|
@ -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 ''
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ export abstract class Actor implements ServerActor {
|
|||
updatedAt: Date | string
|
||||
|
||||
avatar: ActorImage
|
||||
avatarUrl: string
|
||||
|
||||
isLocal: boolean
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue