Add account link in videos list
authorChocobozzz <me@florianbigard.com>
Wed, 25 Apr 2018 12:32:19 +0000 (14:32 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 25 Apr 2018 12:32:19 +0000 (14:32 +0200)
client/src/app/shared/video/video-miniature.component.html
client/src/app/shared/video/video-miniature.component.scss
client/src/app/shared/video/video.model.ts
client/src/app/videos/+video-watch/video-watch.component.html
client/src/app/videos/+video-watch/video-watch.component.scss
server/models/video/video.ts
server/tests/utils/videos/videos.ts
shared/models/videos/video.model.ts

index 2334321425cdc189af2d4f0cc8bc091b6f106cfb..d0b305509b41b4afe77ee7c1390d68a5d83f331b 100644 (file)
@@ -12,6 +12,6 @@
     </span>
 
     <span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span>
-    <span class="video-miniature-account">{{ video.by }}</span>
+    <a class="video-miniature-account" [routerLink]="[ '/account', video.account.id ]">{{ video.by }}</a>
   </div>
 </div>
index ece090828d0633b5a68e8d87d6e4338c05c52526..588eea3a757081114acaa6f84ea3dbdf88fc2156 100644 (file)
     }
 
     .video-miniature-account {
+      @include disable-default-a-behaviour;
+
       display: block;
       overflow: hidden;
       text-overflow: ellipsis;
       white-space: nowrap;
       font-size: 13px;
       color: #585858;
+
+      &:hover {
+        color: #303030;
+      }
     }
   }
 }
index a284c1688fcde9c3c8f23462b7699a8b60a65bb2..2e85f40eff008f9e1b9af60955e9b3c4182f6e65 100644 (file)
@@ -35,6 +35,8 @@ export class Video implements VideoServerModel {
   nsfw: boolean
 
   account: {
+    id: number
+    uuid: string
     name: string
     displayName: string
     url: string
index abda5043e79136cb996b5a69beffc68988b40ddd..036d75d3ca2f298e401499355fd6f501a950de80 100644 (file)
@@ -23,7 +23,7 @@
 
           <div class="video-info-by">
             <a [routerLink]="[ '/account', video.account.id ]" title="Go the account page">
-              By {{ video.by }}
+              <span>By {{ video.by }}</span>
               <img [src]="getAvatarPath()" alt="Account avatar" />
             </a>
           </div>
index 1b44f0d6aaeab469f2c9b18c40dbe49db3d57c3e..b4d9841fe728d4a27e7e904e8a737199c3b0c05e 100644 (file)
         font-size: 15px;
       }
 
-      .video-info-by {
+      .video-info-by a {
+        @include disable-default-a-behaviour;
+
         display: flex;
         align-items: center;
         font-size: 13px;
+        color: #000;
 
-        a {
-          color: black;
-          display: inline-block;
+        span:hover {
+          opacity: 0.8;
         }
 
         img {
index f23fac2ab1b3da2d2027b6c98b0479bc4d979638..ea466fccd3b3fe78702d639879069cc649437f69 100644 (file)
@@ -104,13 +104,13 @@ enum ScopeNames {
     videoChannelId?: number
   }) => {
     const accountInclude = {
-      attributes: [ 'name' ],
+      attributes: [ 'id', 'name' ],
       model: AccountModel.unscoped(),
       required: true,
       where: {},
       include: [
         {
-          attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ],
+          attributes: [ 'id', 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ],
           model: ActorModel.unscoped(),
           required: true,
           where: VideoModel.buildActorWhereWithFilter(options.filter),
@@ -1078,6 +1078,8 @@ export class VideoModel extends Model<VideoModel> {
       updatedAt: this.updatedAt,
       publishedAt: this.publishedAt,
       account: {
+        id: formattedAccount.id,
+        uuid: formattedAccount.uuid,
         name: formattedAccount.name,
         displayName: formattedAccount.displayName,
         url: formattedAccount.url,
index 2ba3a860b8eba13f9dab7145029ce59e522ceb81..d1d8c07dfa2af92de5790a96af859e6eae6beeee 100644 (file)
@@ -486,6 +486,8 @@ async function completeVideoCheck (
   expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
   expect(video.nsfw).to.equal(attributes.nsfw)
   expect(video.description).to.equal(attributes.description)
+  expect(video.account.id).to.be.a('number')
+  expect(video.account.uuid).to.be.a('string')
   expect(video.account.host).to.equal(attributes.account.host)
   expect(video.account.name).to.equal(attributes.account.name)
   expect(video.likes).to.equal(attributes.likes)
index 259826689539e1ed88fb8982f4b7371f66b862a7..ba1881da34f47656cee15b7526dae004f0dd5533 100644 (file)
@@ -40,6 +40,8 @@ export interface Video {
   nsfw: boolean
 
   account: {
+    id: number
+    uuid: string
     name: string
     displayName: string
     url: string