Commit 7d6eb294 authored by Sasha Morrissey's avatar Sasha Morrissey Committed by Commit Bot

Make 'Share' button in Files.app redirect to Drive web for Team Drives

The 'Share' button for Files.app previously did not work for sharing
files/folders in Team Drives. Instead, redirect the user to the same
behaviour as 'Manage in Drive' which opens the Drive webpage where the
user can manage the file.

This also disables the button for Folders, which currently do not
support 'Manage in Drive'.

Bug: 716301
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ib56c1aab91ca995dbdf0803348b71986781198c1
Reviewed-on: https://chromium-review.googlesource.com/1011466
Commit-Queue: Sasha Morrissey <sashab@chromium.org>
Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557092}
parent 868717ce
...@@ -71,13 +71,20 @@ function DriveShareAction(entry, volumeManager, ui) { ...@@ -71,13 +71,20 @@ function DriveShareAction(entry, volumeManager, ui) {
* @param {!Array<!Entry>} entries * @param {!Array<!Entry>} entries
* @param {!ActionModelUI} ui * @param {!ActionModelUI} ui
* @param {!VolumeManagerWrapper} volumeManager * @param {!VolumeManagerWrapper} volumeManager
* @return {DriveShareAction} * @return {DriveShareAction|DriveManageAction}
*/ */
DriveShareAction.create = function(entries, volumeManager, ui) { DriveShareAction.create = function(entries, volumeManager, ui) {
if (entries.length !== 1) if (entries.length !== 1)
return null; return null;
return new DriveShareAction(entries[0], volumeManager, ui); // The share URL for Team Drives currently does not support embedding. For
// Team Drives entries, instead point the user to the 'Manage' action.
var entry = entries[0];
if (util.isTeamDriveEntry(entry)) {
return new DriveManageAction(entry, volumeManager, ui);
}
return new DriveShareAction(entry, volumeManager, ui);
}; };
/** /**
......
...@@ -304,7 +304,8 @@ function testTeamDriveDirectoryEntry(callback) { ...@@ -304,7 +304,8 @@ function testTeamDriveDirectoryEntry(callback) {
// "share" action is enabled for Team Drive directories. // "share" action is enabled for Team Drive directories.
var shareAction = actions[ActionsModel.CommonActionId.SHARE]; var shareAction = actions[ActionsModel.CommonActionId.SHARE];
assertTrue(!!shareAction); assertTrue(!!shareAction);
assertTrue(shareAction.canExecute()); // TODO(sashab): Re-enable when 'Manage' works for directories.
assertFalse(shareAction.canExecute());
// "manage in drive" action is disabled for Team Drive directories. // "manage in drive" action is disabled for Team Drive directories.
var manageAction = var manageAction =
......
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