feat: add option to disallow Google Drive in file uploader (#32517)

This commit is contained in:
Raffael Meyer 2025-05-14 01:03:04 +02:00 committed by GitHub
parent d7194aceed
commit dc3ab2ee14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -150,7 +150,7 @@
<div class="mt-1">{{ __("Camera") }}</div>
</button>
<button
v-if="google_drive_settings.enabled"
v-if="allow_google_drive && google_drive_settings.enabled"
class="btn btn-file-upload"
@click="show_google_drive_picker"
>
@ -288,6 +288,9 @@ const props = defineProps({
allow_toggle_optimize: {
default: true,
},
allow_google_drive: {
default: true,
},
});
// variables
@ -315,7 +318,7 @@ if (props.allow_take_photo) {
allow_take_photo.value = window.navigator.mediaDevices;
}
if (frappe.user_id !== "Guest") {
if (frappe.user_id !== "Guest" && props.allow_google_drive) {
frappe.call({
// method only available after login
method: "frappe.integrations.doctype.google_settings.google_settings.get_file_picker_settings",

View file

@ -25,6 +25,7 @@ class FileUploader {
allow_take_photo,
allow_toggle_private,
allow_toggle_optimize,
allow_google_drive,
} = {}) {
frm && frm.attachments.max_reached(true);
@ -63,6 +64,7 @@ class FileUploader {
allow_take_photo,
allow_toggle_private,
allow_toggle_optimize,
allow_google_drive,
});
SetVueGlobals(app);
this.uploader = app.mount(this.wrapper);