Add ability to click on the account in watch page
authorChocobozzz <me@florianbigard.com>
Tue, 17 Apr 2018 13:11:12 +0000 (15:11 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 17 Apr 2018 13:11:12 +0000 (15:11 +0200)
client/src/app/header/header.component.ts
client/src/app/videos/+video-watch/video-watch.component.html
client/src/app/videos/+video-watch/video-watch.component.scss
client/src/app/videos/video-list/video-search.component.ts
package.json
server/controllers/api/videos/index.ts
server/models/video/video.ts
yarn.lock

index 6b0ee67ffa9f365da729600d338146f0343742bb..42de2dd9292fa9beb306571da4c09d66f36f96be 100644 (file)
@@ -1,5 +1,5 @@
 import { Component, OnInit } from '@angular/core'
-import { Router } from '@angular/router'
+import { Router, NavigationEnd } from '@angular/router'
 import { getParameterByName } from '../shared/misc/utils'
 
 @Component({
@@ -14,8 +14,11 @@ export class HeaderComponent implements OnInit {
   constructor (private router: Router) {}
 
   ngOnInit () {
-    const searchQuery = getParameterByName('search', window.location.href)
-    if (searchQuery) this.searchValue = searchQuery
+    this.router.events
+        .filter(e => e instanceof NavigationEnd)
+        .map(() => getParameterByName('search', window.location.href))
+        .filter(searchQuery => !!searchQuery)
+        .subscribe(searchQuery => this.searchValue = searchQuery)
   }
 
   doSearch () {
index 52e3e429abf5178a0eaad9ecd8f813d313bc7f0b..91e590094d68d8327a6c69caa57daf69dbde9aba 100644 (file)
           </div>
 
           <div class="video-info-by">
-            By {{ video.by }}
-            <img [src]="getAvatarPath()" alt="Account avatar" />
+            <a [routerLink]="[ '/videos', 'search' ]" [queryParams]="{ search: video.account.name }" title="Search videos of this account">
+              By {{ video.by }}
+              <img [src]="getAvatarPath()" alt="Account avatar" />
+            </a>
+
             <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed>
           </div>
         </div>
index 8a3e2584b81dbb10d044176968635a11be751094..3ebeccd4bcf2032036ba7ebf2b305c5c30c6455a 100644 (file)
         align-items: center;
         font-size: 13px;
 
+        a {
+          color: black;
+          display: inline-block;
+        }
+
         img {
           @include avatar(18px);
 
index ef9afa7575d67e1d059f68d3c209d30e8a109cbb..46a9dd48efe90e83d1cb11fcf9c63281556d407a 100644 (file)
@@ -7,7 +7,6 @@ import { Subscription } from 'rxjs/Subscription'
 import { AuthService } from '../../core/auth'
 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
 import { VideoService } from '../../shared/video/video.service'
-import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
 
 @Component({
   selector: 'my-videos-search',
@@ -64,6 +63,6 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
   }
 
   generateSyndicationList () {
-    throw new Error('Method not implemented.')
+    throw new Error('Search does not support syndication.')
   }
 }
index e3007bea91a1e76996485681b551e93cfe65fcaa..6a6275fb9f9df6cbb87297ea2918b5b17daaa8d6 100644 (file)
@@ -91,7 +91,7 @@
     "safe-buffer": "^5.0.1",
     "scripty": "^1.5.0",
     "sequelize": "4.37.6",
-    "sequelize-typescript": "^0.6.1",
+    "sequelize-typescript": "0.6.4-beta.0",
     "sharp": "^0.20.0",
     "uuid": "^3.1.0",
     "validator": "^9.0.0",
index 244099015e3a9c1b58e5559368ea02991d90ad7e..b4cd67158100a18f0cb946014ff6988397807d87 100644 (file)
@@ -418,7 +418,7 @@ async function removeVideo (req: express.Request, res: express.Response) {
 }
 
 async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
-  const resultList = await VideoModel.searchAndPopulateAccountAndServerAndTags(
+  const resultList = await VideoModel.searchAndPopulateAccountAndServer(
     req.query.search,
     req.query.start,
     req.query.count,
index ffb9725b4a164025c71a91a769d17e8e54997a95..a7923b477dfe82254c4abe914570a6a9d7863769 100644 (file)
@@ -696,7 +696,7 @@ export class VideoModel extends Model<VideoModel> {
       })
   }
 
-  static async searchAndPopulateAccountAndServerAndTags (value: string, start: number, count: number, sort: string) {
+  static async searchAndPopulateAccountAndServer (value: string, start: number, count: number, sort: string) {
     const query: IFindOptions<VideoModel> = {
       offset: start,
       limit: count,
index 2b445860fde0639982e5a4743c5a11fd532d95cd..73488620ad02a112a277c3dcf7f139eda1228041 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -4585,7 +4585,7 @@ performance-now@^2.1.0:
   version "2.1.0"
   resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
 
-pfeed@^1.1.2:
+pfeed@^1.1.5:
   version "1.1.5"
   resolved "https://registry.yarnpkg.com/pfeed/-/pfeed-1.1.5.tgz#6d0ab54209c60b45de03a15efaab7be867a3f71a"
   dependencies:
@@ -5408,9 +5408,9 @@ send@0.16.2:
     range-parser "~1.2.0"
     statuses "~1.4.0"
 
-sequelize-typescript@^0.6.1:
-  version "0.6.3"
-  resolved "https://registry.yarnpkg.com/sequelize-typescript/-/sequelize-typescript-0.6.3.tgz#567ef7d12193c16aac7ee85e5d321e8980fb817d"
+sequelize-typescript@0.6.4-beta.0:
+  version "0.6.4-beta.0"
+  resolved "https://registry.yarnpkg.com/sequelize-typescript/-/sequelize-typescript-0.6.4-beta.0.tgz#c36e4bfc030dd59b1211967ecace243601b2242e"
   dependencies:
     "@types/bluebird" "3.5.18"
     "@types/node" "6.0.41"