]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add owner in video channel page
authorChocobozzz <me@florianbigard.com>
Wed, 23 May 2018 09:38:00 +0000 (11:38 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 23 May 2018 09:38:18 +0000 (11:38 +0200)
client/src/app/+video-channels/video-channels.component.html
client/src/app/shared/video-channel/video-channel.model.ts
client/src/sass/include/_mixins.scss
server/models/video/video-channel.ts
shared/models/videos/video-channel.model.ts

index 6f14e62a1f700b026d5075b5f65b6a9aef12cf95..da0d76acfe2891462c4aad4a4255aaf760c86930 100644 (file)
@@ -9,6 +9,11 @@
           <div class="actor-display-name">{{ videoChannel.displayName }}</div>
         </div>
         <div class="actor-followers">{{ videoChannel.followersCount }} subscribers</div>
+
+        <a [routerLink]="[ '/accounts', videoChannel.ownerAccount.id ]" title="Go the owner account page" class="actor-owner">
+          <span>Created by {{ videoChannel.ownerBy }}</span>
+          <img [src]="videoChannel.ownerAvatarUrl" alt="Owner account avatar" />
+        </a>
       </div>
     </div>
 
index 01381ac304f0f99ef0d03eca92c131fabb564504..199c1d3b895956ea83f1e693556b70f426eff8ea 100644 (file)
@@ -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)
+    }
   }
 }
index ffbedd3f58afb9b1d71b761f2ccc251badff6856..dce3430fd12ef79ef69bb1b186069a1e5ff7a74c 100644 (file)
     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;
   }
 
 @mixin avatar ($size) {
   object-fit: cover;
-  border-radius:50%;
+  border-radius: 50%;
   width: $size;
   height: $size;
 }
       .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;
+        }
+      }
     }
   }
 
     margin-right: 3px;
     background-image: url('/assets/images/admin/add.svg');
   }
-}
\ No newline at end of file
+}
index 8498143fe33b7d5c4781532bbcb0fd68cfd8b326..b9df14eca77c6fd70d841a749a108a24d1a2a2a1 100644 (file)
@@ -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<VideoChannelModel> {
       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)
   }
index 02fbcc315a1ab09e7a51a76f4dee5a482282de14..6e61183a72db3c5f3331f4fce330c619da7dcaba 100644 (file)
@@ -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
 }