diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-04 16:58:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-04 17:31:28 +0200 |
commit | b1ee8526d35eb7df4fb70ae755eae08e7497042c (patch) | |
tree | 0cf4ea1faeef2294dd4001708e917fb5f9699fc9 /client/src/app/search/search.component.ts | |
parent | 8cd7faaa331f83903f0bbaead288661218e38bdb (diff) | |
download | PeerTube-b1ee8526d35eb7df4fb70ae755eae08e7497042c.tar.gz PeerTube-b1ee8526d35eb7df4fb70ae755eae08e7497042c.tar.zst PeerTube-b1ee8526d35eb7df4fb70ae755eae08e7497042c.zip |
Fix search results on mobile
Diffstat (limited to 'client/src/app/search/search.component.ts')
-rw-r--r-- | client/src/app/search/search.component.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index 4c540ca72..475fdd277 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts | |||
@@ -31,6 +31,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
31 | 31 | ||
32 | private subActivatedRoute: Subscription | 32 | private subActivatedRoute: Subscription |
33 | private isInitialLoad = true | 33 | private isInitialLoad = true |
34 | private firstSearch = true | ||
34 | 35 | ||
35 | private channelsPerPage = 2 | 36 | private channelsPerPage = 2 |
36 | 37 | ||
@@ -103,13 +104,16 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
103 | .concat(videosResult.videos) | 104 | .concat(videosResult.videos) |
104 | this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total | 105 | this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total |
105 | 106 | ||
106 | // Focus on channels | 107 | // Focus on channels if there are no enough videos |
107 | if (this.channelsPerPage !== 10 && videosResult.videos.length < this.pagination.itemsPerPage) { | 108 | if (this.firstSearch === true && videosResult.videos.length < this.pagination.itemsPerPage) { |
108 | this.resetPagination() | 109 | this.resetPagination() |
110 | this.firstSearch = false | ||
109 | 111 | ||
110 | this.channelsPerPage = 10 | 112 | this.channelsPerPage = 10 |
111 | this.search() | 113 | this.search() |
112 | } | 114 | } |
115 | |||
116 | this.firstSearch = false | ||
113 | }, | 117 | }, |
114 | 118 | ||
115 | error => { | 119 | error => { |