mirror of
https://github.com/zoriya/flood.git
synced 2026-06-02 19:11:14 +00:00
Handle changing multiple files' priority at once
This commit is contained in:
@@ -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]));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ class FeedCollection {
|
||||
init() {
|
||||
this.db.find({}, (err, docs) => {
|
||||
if (err) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
let newItemHandler = this.handleNewItem.bind(this);
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user