Handle changing multiple files' priority at once

This commit is contained in:
John Furrow
2016-08-31 21:49:58 -07:00
parent 168b349d38
commit b997efc26e
3 changed files with 8 additions and 5 deletions
+5 -2
View File
@@ -276,11 +276,14 @@ class ClientRequest {
}
setFilePriorityMethodCall(options) {
let fileIndices = this.getEnsuredArray(options.fileIndices);
let hashes = this.getEnsuredArray(options.hashes);
hashes.forEach((hash) => {
this.requests.push(this.getMethodCall('f.priority.set',
[`${hash}:f${options.fileIndex}`, options.priority]));
fileIndices.forEach((fileIndex) => {
this.requests.push(this.getMethodCall('f.priority.set',
[`${hash}:f${fileIndex}`, options.priority]));
});
this.requests.push(this.getMethodCall('d.update_priorities', [hash]));
});
}
+1 -1
View File
@@ -154,7 +154,7 @@ class FeedCollection {
init() {
this.db.find({}, (err, docs) => {
if (err) {
return ;
return;
}
let newItemHandler = this.handleNewItem.bind(this);
+2 -2
View File
@@ -253,10 +253,10 @@ var client = {
setFilePriority: (hashes, data, callback) => {
// TODO Add support for multiple hashes.
let fileIndex = data.fileIndices[0];
let fileIndices = data.fileIndices;
let request = new ClientRequest();
request.add('setFilePriority', {hashes, fileIndex, priority: data.priority});
request.add('setFilePriority', {hashes, fileIndices, priority: data.priority});
request.onComplete(callback);
request.send();
},