fix(search): fix search more button indication on peer search
This commit is contained in:
parent
bfc03b6f2d
commit
f909fb5aaa
@ -160,6 +160,15 @@ class Search extends Component {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
calcTorrentsFiles(torrents)
|
||||||
|
{
|
||||||
|
let files = 0;
|
||||||
|
torrents.forEach((torrent) => {
|
||||||
|
if(torrent.path && torrent.path.length > 0)
|
||||||
|
files += torrent.path.length
|
||||||
|
});
|
||||||
|
return files
|
||||||
|
}
|
||||||
moreFiles() {
|
moreFiles() {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
this.searchFiles.forEach((torrent) => {
|
this.searchFiles.forEach((torrent) => {
|
||||||
@ -179,12 +188,8 @@ class Search extends Component {
|
|||||||
}, window.customLoader((torrents) => {
|
}, window.customLoader((torrents) => {
|
||||||
if(torrents) {
|
if(torrents) {
|
||||||
this.searchFiles = this.searchFiles.concat(torrents);
|
this.searchFiles = this.searchFiles.concat(torrents);
|
||||||
let files = 0;
|
|
||||||
torrents.forEach((torrent) => {
|
if(this.calcTorrentsFiles(torrents) != this.searchLimit)
|
||||||
if(torrent.path && torrent.path.length > 0)
|
|
||||||
files += torrent.path.length
|
|
||||||
});
|
|
||||||
if(files != this.searchLimit)
|
|
||||||
this.moreSearchFiles = false;
|
this.moreSearchFiles = false;
|
||||||
|
|
||||||
this.mergeFiles()
|
this.mergeFiles()
|
||||||
@ -228,6 +233,10 @@ class Search extends Component {
|
|||||||
this.remoteSearchTorrent = (torrents) => {
|
this.remoteSearchTorrent = (torrents) => {
|
||||||
if(!torrents)
|
if(!torrents)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if(torrents.length === this.searchLimit)
|
||||||
|
this.moreSearchTorrents = true;
|
||||||
|
|
||||||
this.searchTorrents = _.unionBy(this.searchTorrents, torrents, 'hash')
|
this.searchTorrents = _.unionBy(this.searchTorrents, torrents, 'hash')
|
||||||
this.onSearchUpdate('remote torrents')
|
this.onSearchUpdate('remote torrents')
|
||||||
}
|
}
|
||||||
@ -236,6 +245,10 @@ class Search extends Component {
|
|||||||
this.remoteSearchFiles = (torrents) => {
|
this.remoteSearchFiles = (torrents) => {
|
||||||
if(!torrents)
|
if(!torrents)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if(torrents.length > 0 && this.calcTorrentsFiles(torrents) === this.searchLimit)
|
||||||
|
this.moreSearchFiles = true;
|
||||||
|
|
||||||
this.searchFiles = _.unionBy(this.searchFiles, torrents, 'hash')
|
this.searchFiles = _.unionBy(this.searchFiles, torrents, 'hash')
|
||||||
this.mergeFiles()
|
this.mergeFiles()
|
||||||
this.onSearchUpdate('remote files')
|
this.onSearchUpdate('remote files')
|
||||||
|
Loading…
Reference in New Issue
Block a user