aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-23 11:38:00 +0200
committerChocobozzz <me@florianbigard.com>2018-05-23 11:38:18 +0200
commita4f99a766bd07851a37dd7ff8fed7acc2a3ef021 (patch)
tree825ae223689f9b6df1553da0f67f44802b1fe4ca
parentb851dabf78d0a7ffad64913498c1f9cd37f16268 (diff)
downloadPeerTube-a4f99a766bd07851a37dd7ff8fed7acc2a3ef021.tar.gz
PeerTube-a4f99a766bd07851a37dd7ff8fed7acc2a3ef021.tar.zst
PeerTube-a4f99a766bd07851a37dd7ff8fed7acc2a3ef021.zip
Add owner in video channel page
-rw-r--r--client/src/app/+video-channels/video-channels.component.html5
-rw-r--r--client/src/app/shared/video-channel/video-channel.model.ts15
-rw-r--r--client/src/sass/include/_mixins.scss27
-rw-r--r--server/models/video/video-channel.ts11
-rw-r--r--shared/models/videos/video-channel.model.ts6
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 @@
9 <div class="actor-display-name">{{ videoChannel.displayName }}</div> 9 <div class="actor-display-name">{{ videoChannel.displayName }}</div>
10 </div> 10 </div>
11 <div class="actor-followers">{{ videoChannel.followersCount }} subscribers</div> 11 <div class="actor-followers">{{ videoChannel.followersCount }} subscribers</div>
12
13 <a [routerLink]="[ '/accounts', videoChannel.ownerAccount.id ]" title="Go the owner account page" class="actor-owner">
14 <span>Created by {{ videoChannel.ownerBy }}</span>
15 <img [src]="videoChannel.ownerAvatarUrl" alt="Owner account avatar" />
16 </a>
12 </div> 17 </div>
13 </div> 18 </div>
14 19
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 @@
1import { VideoChannel as ServerVideoChannel } from '../../../../../shared/models/videos/video-channel.model' 1import { VideoChannel as ServerVideoChannel } from '../../../../../shared/models/videos/video-channel.model'
2import { Actor } from '../actor/actor.model' 2import { Actor } from '../actor/actor.model'
3import { Account } from '../../../../../shared/models/actors'
3 4
4export class VideoChannel extends Actor implements ServerVideoChannel { 5export class VideoChannel extends Actor implements ServerVideoChannel {
5 displayName: string 6 displayName: string
6 description: string 7 description: string
7 support: string 8 support: string
8 isLocal: boolean 9 isLocal: boolean
9 ownerAccount?: { 10 ownerAccount?: Account
10 id: number 11 ownerBy?: string
11 uuid: string 12 ownerAvatarUrl?: string
12 }
13 13
14 constructor (hash: ServerVideoChannel) { 14 constructor (hash: ServerVideoChannel) {
15 super(hash) 15 super(hash)
@@ -18,6 +18,11 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
18 this.description = hash.description 18 this.description = hash.description
19 this.support = hash.support 19 this.support = hash.support
20 this.isLocal = hash.isLocal 20 this.isLocal = hash.isLocal
21 this.ownerAccount = hash.ownerAccount 21
22 if (hash.ownerAccount) {
23 this.ownerAccount = hash.ownerAccount
24 this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
25 this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount)
26 }
22 } 27 }
23} 28}
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 @@
160 position: absolute; 160 position: absolute;
161 pointer-events: none; 161 pointer-events: none;
162 border: 5px solid rgba(0, 0, 0, 0); 162 border: 5px solid rgba(0, 0, 0, 0);
163 border-top-color: #000000; 163 border-top-color: #000;
164 margin-top: -2px; 164 margin-top: -2px;
165 z-index: 100; 165 z-index: 100;
166 } 166 }
@@ -286,7 +286,7 @@
286 286
287@mixin avatar ($size) { 287@mixin avatar ($size) {
288 object-fit: cover; 288 object-fit: cover;
289 border-radius:50%; 289 border-radius: 50%;
290 width: $size; 290 width: $size;
291 height: $size; 291 height: $size;
292} 292}
@@ -365,6 +365,27 @@
365 .actor-followers { 365 .actor-followers {
366 font-size: 15px; 366 font-size: 15px;
367 } 367 }
368
369 .actor-owner {
370 @include disable-default-a-behaviour;
371
372 display: block;
373 font-size: 13px;
374 margin-top: 4px;
375 color: #000;
376
377 span:hover {
378 opacity: 0.8;
379 }
380
381 img {
382 @include avatar(18px);
383
384 margin-left: 7px;
385 position: relative;
386 top: -2px;
387 }
388 }
368 } 389 }
369 } 390 }
370 391
@@ -389,4 +410,4 @@
389 margin-right: 3px; 410 margin-right: 3px;
390 background-image: url('/assets/images/admin/add.svg'); 411 background-image: url('/assets/images/admin/add.svg');
391 } 412 }
392} \ No newline at end of file 413}
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 {
34 [ScopeNames.WITH_ACCOUNT]: { 34 [ScopeNames.WITH_ACCOUNT]: {
35 include: [ 35 include: [
36 { 36 {
37 model: () => AccountModel, 37 model: () => AccountModel.unscoped(),
38 required: true, 38 required: true,
39 include: [ 39 include: [
40 { 40 {
41 model: () => ActorModel, 41 model: () => ActorModel.unscoped(),
42 required: true 42 required: true
43 } 43 }
44 ] 44 ]
@@ -247,12 +247,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
247 videos: undefined 247 videos: undefined
248 } 248 }
249 249
250 if (this.Account) { 250 if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON()
251 videoChannel.ownerAccount = {
252 id: this.Account.id,
253 uuid: this.Account.Actor.uuid
254 }
255 }
256 251
257 return Object.assign(actor, videoChannel) 252 return Object.assign(actor, videoChannel)
258 } 253 }
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 @@
1import { Actor } from '../actors/actor.model' 1import { Actor } from '../actors/actor.model'
2import { Video } from './video.model' 2import { Video } from './video.model'
3import { Account } from '../actors'
3 4
4export interface VideoChannel extends Actor { 5export interface VideoChannel extends Actor {
5 displayName: string 6 displayName: string
6 description: string 7 description: string
7 support: string 8 support: string
8 isLocal: boolean 9 isLocal: boolean
9 ownerAccount?: { 10 ownerAccount?: Account
10 id: number
11 uuid: string
12 }
13} 11}