-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Google Drive actions improvements (#11837)
* Download File improvements * Deprecating 'create file' and improving 'upload file' * Text improvements * text improvement * text improvement * adjustments * Delete File improvements * Adding theme id async options * adjustment * Get Shared Drive improvements * Improvements * Find Forms & Sheets improvements * Search Query improvements * Forms label * Reusing query method and props * Description updates * find file - reusing common query stuff * More search query improvements * Description adjustments * Moving constants file to common * Version bumps * Version bumps * Find Spreadsheets bugfix * Share File improvements and fixes * Rename "share file" > "share file or folder" * Summary improvement * Version bump
- Loading branch information
Showing
61 changed files
with
328 additions
and
570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { | ||
GOOGLE_DRIVE_FOLDER_MIME_TYPE, | ||
GOOGLE_DRIVE_GRANTEE_DOMAIN, | ||
GOOGLE_DRIVE_GRANTEE_GROUP, | ||
GOOGLE_DRIVE_GRANTEE_USER, | ||
GOOGLE_DRIVE_ROLE_OPTIONS, | ||
GOOGLE_DRIVE_ROLE_OPTION_FILEORGANIZER, | ||
GOOGLE_DRIVE_ROLE_WRITER, | ||
} from "../../common/constants.mjs"; | ||
import googleDrive from "../../google_drive.app.mjs"; | ||
|
||
|
@@ -14,10 +17,10 @@ import googleDrive from "../../google_drive.app.mjs"; | |
*/ | ||
export default { | ||
key: "google_drive-add-file-sharing-preference", | ||
name: "Share File", | ||
name: "Share File or Folder", | ||
description: | ||
"Add a [sharing permission](https://support.google.com/drive/answer/7166529) to the sharing preferences of a file or folder and provide a sharing URL. [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)", | ||
version: "0.1.5", | ||
version: "0.1.6", | ||
type: "action", | ||
props: { | ||
googleDrive, | ||
|
@@ -38,6 +41,7 @@ export default { | |
], | ||
optional: false, | ||
description: "The file or folder to share", | ||
reloadProps: true, | ||
}, | ||
type: { | ||
propDefinition: [ | ||
|
@@ -47,16 +51,25 @@ export default { | |
reloadProps: true, | ||
}, | ||
}, | ||
additionalProps() { | ||
async additionalProps() { | ||
const obj = {}; | ||
const { | ||
fileOrFolderId, type, | ||
} = this; | ||
if (!fileOrFolderId || !type) return obj; | ||
|
||
const { mimeType } = await this.googleDrive.getFile(this.fileOrFolderId, { | ||
fields: "mimeType", | ||
}); | ||
|
||
const emailAddress = { | ||
type: "string", | ||
label: "Email Address", | ||
description: | ||
"Enter the email address of the user that you'd like to share the file or folder with (e.g. `[email protected]`).", | ||
}; | ||
|
||
switch (this.type) { | ||
switch (type) { | ||
case GOOGLE_DRIVE_GRANTEE_DOMAIN: | ||
obj.domain = { | ||
type: "string", | ||
|
@@ -80,13 +93,22 @@ export default { | |
break; | ||
} | ||
|
||
const isFolder = mimeType === GOOGLE_DRIVE_FOLDER_MIME_TYPE; | ||
const options = GOOGLE_DRIVE_ROLE_OPTIONS; | ||
|
||
if (isFolder) { | ||
const writerOpt = options.find(({ value }) => value === GOOGLE_DRIVE_ROLE_WRITER); | ||
writerOpt.label = writerOpt.label.replace(/Writer/, "Contributor"); | ||
options.push(GOOGLE_DRIVE_ROLE_OPTION_FILEORGANIZER); | ||
} | ||
|
||
return { | ||
...obj, | ||
role: { | ||
type: "string", | ||
label: "Role", | ||
description: "The role granted by this permission", | ||
options: GOOGLE_DRIVE_ROLE_OPTIONS, | ||
options, | ||
}, | ||
}; | ||
}, | ||
|
@@ -107,9 +129,9 @@ export default { | |
const webViewLink = resp.webViewLink; | ||
$.export( | ||
"$summary", | ||
`Successfully shared file "${resp.name}" with ${this.type} "${ | ||
this.emailAddress ?? this.domain ?? "" | ||
}"`, | ||
`Successfully shared file "${resp.name}" with ${type} "${ | ||
emailAddress ?? domain ?? "" | ||
}" with role '${role}'`, | ||
); | ||
return webViewLink; | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.