feat(integrations): add IMAP Gmail labels/delete and Watch Folder cloud source support

- Add delete_after_process and gmail_apply_labels checkboxes to IMAP integration UI
- Add source_type selector (Local/S3/Dropbox/Google Drive/OneDrive/Nextcloud/WebDAV) to Watch Folder UI
- Add per-source-type config and credential fields for watch folders
- Add delete_after_process checkbox to Watch Folder settings
- Fix field name mismatch (path → folder_path) in Watch Folder UI
- Update pull_inbox() to accept and respect gmail_apply_labels parameter
- Update _pull_user_integration_imap() to read gmail_apply_labels from config
- Add per-user cloud scanning functions for S3, Dropbox, Google Drive, OneDrive, Nextcloud, WebDAV
- Update _pull_user_integration_watch_folders() to dispatch based on source_type
- Update IMAP and WATCH_FOLDER config shape documentation in models.py

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-09 02:15:03 +00:00
parent 61e402f785
commit e7d1289f1b
4 changed files with 1037 additions and 36 deletions
+47 -1
View File
@@ -544,9 +544,55 @@ class UserIntegration(Base):
IMAP:
config = {"host": "imap.example.com", "port": 993,
"username": "user@example.com", "use_ssl": true,
"delete_after_process": false}
"delete_after_process": false,
"gmail_apply_labels": true}
credentials = {"password": "secret"}
WATCH_FOLDER (local):
config = {"source_type": "local",
"folder_path": "/data/inbox",
"delete_after_process": false}
WATCH_FOLDER (s3):
config = {"source_type": "s3", "bucket": "my-bucket",
"region": "us-east-1", "prefix": "inbox/",
"endpoint_url": null, "delete_after_process": false}
credentials = {"access_key_id": "AKI…", "secret_access_key": ""}
WATCH_FOLDER (dropbox):
config = {"source_type": "dropbox",
"folder_path": "/Inbox/Scanner",
"delete_after_process": false}
credentials = {"refresh_token": "", "app_key": "",
"app_secret": ""}
WATCH_FOLDER (google_drive):
config = {"source_type": "google_drive",
"folder_id": "1abc…",
"delete_after_process": false}
credentials = {"credentials_json": "{…service-account…}"}
WATCH_FOLDER (onedrive):
config = {"source_type": "onedrive",
"folder_path": "/Documents/Inbox",
"delete_after_process": false}
credentials = {"refresh_token": "", "client_id": "",
"client_secret": ""}
WATCH_FOLDER (nextcloud):
config = {"source_type": "nextcloud",
"url": "https://cloud.example.com",
"folder_path": "/Documents/Inbox",
"delete_after_process": false}
credentials = {"username": "user", "password": "secret"}
WATCH_FOLDER (webdav):
config = {"source_type": "webdav",
"url": "https://webdav.example.com/dav/",
"folder_path": "/remote.php/webdav/Inbox",
"delete_after_process": false}
credentials = {"username": "user", "password": "secret"}
S3:
config = {"bucket": "my-bucket", "region": "us-east-1",
"endpoint_url": null, "folder_prefix": ""}