Commit 671029f8 authored by Isabella Scalzi's avatar Isabella Scalzi Committed by Commit Bot

[quickview] address comments in CL:2011584

The current code for updating |this.tasks_| does not account for when
|this.tasks_| is an empty array. Fix this: Only update |this.tasks_| if
there are tasks to update.

Also remove redundant function |getAvailableTasks_|.

Bug: 1038799
Change-Id: Iacf74ad6d620ce5001a7de73bfa762b0ea0f0be7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2014206
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733891}
parent a6cc2f82
...@@ -293,15 +293,6 @@ class QuickViewController { ...@@ -293,15 +293,6 @@ class QuickViewController {
} }
} }
/**
* @param {!FileEntry} entry
* @return {!Promise<!FileTasks>}
* @private
*/
getAvailableTasks_(entry) {
return this.taskController_.getEntryFileTasks(entry);
}
/** /**
* Update quick view using current entries. * Update quick view using current entries.
* *
...@@ -328,7 +319,7 @@ class QuickViewController { ...@@ -328,7 +319,7 @@ class QuickViewController {
return Promise return Promise
.all([ .all([
this.metadataModel_.get([entry], ['thumbnailUrl']), this.metadataModel_.get([entry], ['thumbnailUrl']),
this.getAvailableTasks_(entry) this.taskController_.getEntryFileTasks(entry)
]) ])
.then(values => { .then(values => {
const items = (/**@type{Array<MetadataItem>}*/ (values[0])); const items = (/**@type{Array<MetadataItem>}*/ (values[0]));
...@@ -373,7 +364,10 @@ class QuickViewController { ...@@ -373,7 +364,10 @@ class QuickViewController {
browsable: params.browsable || false, browsable: params.browsable || false,
}); });
this.tasks_ = fileTasks; if (params.hasTask) {
this.tasks_ = fileTasks;
}
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment