From a4f99a766bd07851a37dd7ff8fed7acc2a3ef021 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 23 May 2018 11:38:00 +0200 Subject: [PATCH] Add owner in video channel page --- .../video-channels.component.html | 5 ++++ .../video-channel/video-channel.model.ts | 15 +++++++---- client/src/sass/include/_mixins.scss | 27 ++++++++++++++++--- server/models/video/video-channel.ts | 11 +++----- shared/models/videos/video-channel.model.ts | 6 ++--- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/client/src/app/+video-channels/video-channels.component.html b/client/src/app/+video-channels/video-channels.component.html index 6f14e62a1..da0d76acf 100644 --- a/client/src/app/+video-channels/video-channels.component.html +++ b/client/src/app/+video-channels/video-channels.component.html @@ -9,6 +9,11 @@
{{ videoChannel.displayName }}
{{ videoChannel.followersCount }} subscribers
+ + + Created by {{ videoChannel.ownerBy }} + Owner account avatar + diff --git a/client/src/app/shared/video-channel/video-channel.model.ts b/client/src/app/shared/video-channel/video-channel.model.ts index 01381ac30..199c1d3b8 100644 --- a/client/src/app/shared/video-channel/video-channel.model.ts +++ b/client/src/app/shared/video-channel/video-channel.model.ts @@ -1,15 +1,15 @@ import { VideoChannel as ServerVideoChannel } from '../../../../../shared/models/videos/video-channel.model' import { Actor } from '../actor/actor.model' +import { Account } from '../../../../../shared/models/actors' export class VideoChannel extends Actor implements ServerVideoChannel { displayName: string description: string support: string isLocal: boolean - ownerAccount?: { - id: number - uuid: string - } + ownerAccount?: Account + ownerBy?: string + ownerAvatarUrl?: string constructor (hash: ServerVideoChannel) { super(hash) @@ -18,6 +18,11 @@ export class VideoChannel extends Actor implements ServerVideoChannel { this.description = hash.description this.support = hash.support this.isLocal = hash.isLocal - this.ownerAccount = hash.ownerAccount + + if (hash.ownerAccount) { + this.ownerAccount = hash.ownerAccount + this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) + this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) + } } } diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss index ffbedd3f5..dce3430fd 100644 --- a/client/src/sass/include/_mixins.scss +++ b/client/src/sass/include/_mixins.scss @@ -160,7 +160,7 @@ position: absolute; pointer-events: none; border: 5px solid rgba(0, 0, 0, 0); - border-top-color: #000000; + border-top-color: #000; margin-top: -2px; z-index: 100; } @@ -286,7 +286,7 @@ @mixin avatar ($size) { object-fit: cover; - border-radius:50%; + border-radius: 50%; width: $size; height: $size; } @@ -365,6 +365,27 @@ .actor-followers { font-size: 15px; } + + .actor-owner { + @include disable-default-a-behaviour; + + display: block; + font-size: 13px; + margin-top: 4px; + color: #000; + + span:hover { + opacity: 0.8; + } + + img { + @include avatar(18px); + + margin-left: 7px; + position: relative; + top: -2px; + } + } } } @@ -389,4 +410,4 @@ margin-right: 3px; background-image: url('/assets/images/admin/add.svg'); } -} \ No newline at end of file +} diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 8498143fe..b9df14eca 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -34,11 +34,11 @@ enum ScopeNames { [ScopeNames.WITH_ACCOUNT]: { include: [ { - model: () => AccountModel, + model: () => AccountModel.unscoped(), required: true, include: [ { - model: () => ActorModel, + model: () => ActorModel.unscoped(), required: true } ] @@ -247,12 +247,7 @@ export class VideoChannelModel extends Model { videos: undefined } - if (this.Account) { - videoChannel.ownerAccount = { - id: this.Account.id, - uuid: this.Account.Actor.uuid - } - } + if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON() return Object.assign(actor, videoChannel) } diff --git a/shared/models/videos/video-channel.model.ts b/shared/models/videos/video-channel.model.ts index 02fbcc315..6e61183a7 100644 --- a/shared/models/videos/video-channel.model.ts +++ b/shared/models/videos/video-channel.model.ts @@ -1,13 +1,11 @@ import { Actor } from '../actors/actor.model' import { Video } from './video.model' +import { Account } from '../actors' export interface VideoChannel extends Actor { displayName: string description: string support: string isLocal: boolean - ownerAccount?: { - id: number - uuid: string - } + ownerAccount?: Account } -- 2.25.1