Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoogleDrive: reenable shared drive checkboxes + remove team drive checkboxes #5254

Closed
wants to merge 1 commit into from

Conversation

lakesare
Copy link
Contributor

@lakesare lakesare commented Jun 17, 2024

Explanation

Reminder that GoogleDrive has 3 types of shared folders (see #5232).

This PR:

  • Reenables the checkbox for "shared with me" folder [denoted by folder.id = VIRTUAL_SHARED_DIR]

    This is in preparation for Provider views rewrite (.files, .folders => .partialTree) #5050 PR - we will want to see that when we select something inside of this folder, this folder is partially checked

    BEFORE

    image

    AFTER

    image

    Also - the reason we originally removed this checkbox is because "shared-with-me" folder tends to have thousands of files, and the user might get stuck by accidentally checking this folder. This is not a problem anymore after we implemented fetch aborts.

  • Removes checkboxes for shared drives [denoted by folder.custom.isSharedDrive]

    BEFORE

    People would be clicking on the checkbox, and it would be doing nothing. That's a very weird UI.

    AFTER

    We just remove checkboxes for team drives.
    You might ask - why not leave them as normal checkboxes, like we just did for the "shared with me" folder.
    That's explained in New provider views + disabling GoogleDrive "shared drives" #5232 (comment) - basically, the original developer said "that's throwing errors". I don't think that issue persisted, but we cannot check it, because team drives are hard to test - so let's play it safe, and keep team drive checkboxes disabled, just with a better UI.

Copy link
Contributor

Diff output files
diff --git a/packages/@uppy/google-drive/lib/GoogleDrive.js b/packages/@uppy/google-drive/lib/GoogleDrive.js
index cf021fc..6022578 100644
--- a/packages/@uppy/google-drive/lib/GoogleDrive.js
+++ b/packages/@uppy/google-drive/lib/GoogleDrive.js
@@ -1,7 +1,7 @@
 import { getAllowedHosts, Provider, tokenStorage } from "@uppy/companion-client";
 import { UIPlugin } from "@uppy/core";
+import { ProviderViews } from "@uppy/provider-views";
 import { h } from "preact";
-import DriveProviderViews from "./DriveProviderViews.js";
 import locale from "./locale.js";
 const packageJson = {
   "version": "4.0.0-beta.6",
@@ -72,7 +72,7 @@ export default class GoogleDrive extends UIPlugin {
     this.render = this.render.bind(this);
   }
   install() {
-    this.view = new DriveProviderViews(this, {
+    this.view = new ProviderViews(this, {
       provider: this.provider,
       loadAllFiles: true,
     });
diff --git a/packages/@uppy/provider-views/lib/Browser.js b/packages/@uppy/provider-views/lib/Browser.js
index 60ad2f8..2f03a51 100644
--- a/packages/@uppy/provider-views/lib/Browser.js
+++ b/packages/@uppy/provider-views/lib/Browser.js
@@ -6,7 +6,6 @@ import { useMemo } from "preact/hooks";
 import FooterActions from "./FooterActions.js";
 import Item from "./Item/index.js";
 import SearchFilterInput from "./SearchFilterInput.js";
-const VIRTUAL_SHARED_DIR = "shared-with-me";
 function ListItem(props) {
   const {
     currentSelection,
@@ -22,6 +21,7 @@ function ListItem(props) {
     f,
   } = props;
   if (f.isFolder) {
+    var _f$custom;
     return Item({
       showTitles,
       viewType,
@@ -34,7 +34,7 @@ function ListItem(props) {
       recordShiftKeyPress,
       type: "folder",
       isDisabled: false,
-      isCheckboxDisabled: f.id === VIRTUAL_SHARED_DIR,
+      isCheckboxDisabled: !!((_f$custom = f.custom) != null && _f$custom.isSharedDrive),
       handleFolderClick: () => getNextFolder(f),
     });
   }

@lakesare lakesare closed this Jun 17, 2024
@lakesare lakesare deleted the lakesare/team-drives branch June 17, 2024 21:06
@lakesare
Copy link
Contributor Author

Closing this because realised enabling team drive checkboxes leads to a better UI (once we account for partial states), superseded by 6d4ce89.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant