From 746018f6b81b40e8858303662ac9ec5ce59ac6eb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Apr 2021 11:49:34 +0200 Subject: Refactor actor avatar display --- client/src/app/+search/search.component.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'client/src/app/+search/search.component.ts') diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index 2be952e16..ecede19a3 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts @@ -132,10 +132,6 @@ export class SearchComponent implements OnInit, OnDestroy { return 'internal' } - isExternalChannelUrl () { - return this.getVideoLinkType() === 'external' - } - search () { forkJoin([ this.getVideosObs(), @@ -200,17 +196,33 @@ export class SearchComponent implements OnInit, OnDestroy { this.results = this.results.filter(r => !this.isVideo(r) || r.id !== video.id) } - getChannelUrl (channel: VideoChannel) { + isExternalChannelUrl () { + return this.getVideoLinkType() === 'external' + } + + getExternalChannelUrl (channel: VideoChannel) { // Same algorithm than videos if (this.getVideoLinkType() === 'external') { return channel.url } - if (this.getVideoLinkType() === 'internal') { + // lazy-load or internal + return undefined + } + + getInternalChannelUrl (channel: VideoChannel) { + const linkType = this.getVideoLinkType() + + if (linkType === 'internal') { return [ '/video-channels', channel.nameWithHost ] } - return [ '/search/lazy-load-channel', { url: channel.url } ] + if (linkType === 'lazy-load') { + return [ '/search/lazy-load-channel', { url: channel.url } ] + } + + // external + return undefined } hideActions () { -- cgit v1.2.3