Skip to content

sync: version 16 to v1.0.1#68

Merged
trufurs merged 8 commits into
version-16from
version-16-hotfix
Jun 2, 2026
Merged

sync: version 16 to v1.0.1#68
trufurs merged 8 commits into
version-16from
version-16-hotfix

Conversation

@trufurs

@trufurs trufurs commented Jun 2, 2026

Copy link
Copy Markdown
Member

Description

Bump version from 1.0.0 to 1.0.1
This pull request introduces several improvements to how Gmail attachments and email synchronization are handled, with a focus on robustness, compatibility, and code clarity. The main changes include enhanced parsing and validation of attachment data, improved API flexibility, and better compatibility with Frappe's email handling.

Attachment handling improvements:

  • The get_attachments_data function in activity.py now robustly parses and validates the attachments_data field, handling both JSON strings and lists, logging errors for invalid data, and ensuring only attachments with valid file_url values are returned. It also batches database queries for efficiency.

API and function enhancements:

  • The sync_labels_api function in gmail_account.py now accepts arguments as either a string, dictionary, or None, improving flexibility and type safety. It also adds better error handling for missing required arguments.

Email processing compatibility:

  • The GmailInboundMail class in helpers.py now accepts an optional email_account parameter, ensuring compatibility with Frappe's Email class and handling missing attachment_limit attributes gracefully.
  • The create_new_email function in helpers.py is updated to pass the gmail_account to the GmailInboundMail constructor, ensuring proper initialization.

Code cleanup:

  • Removed unused json imports from multiple files for clarity and to prevent confusion.

Relevant Technical Choices

Testing Instructions

Additional Information:

Screenshot/Screencast

Checklist

  • I have carefully reviewed the code before submitting it for review.
  • This code is adequately covered by unit tests to validate its functionality.
  • I have conducted thorough testing to ensure it functions as intended.
  • A member of the QA team has reviewed and tested this PR (To be checked by QA or code reviewer)

Fixes #

trufurs and others added 8 commits May 15, 2026 14:32
Two bugs in the old per-attachment loop:

1. frappe.db.get_value("File", file_doc_name, "file_url") returns None
   when the File row has been deleted. The function then wrote
   attachment["file_url"] = None and returned it. The timeline_message_box
   template renders a.file_url.split("/") to derive the filename, which
   crashed with "Cannot read properties of null" — the whole form
   timeline failed to render.

2. The frappe.db.get_value call was inside the per-attachment loop,
   so a thread with N attachments did N round-trips against tabFile.

Now a single frappe.db.get_all collects every referenced file_url, and
attachments whose File row is gone are dropped from the returned list
so the template never sees a null file_url.
Improve attachment handling and sync_labels_api robustness
Chore: Bump version from 1.0.0 to 1.0.1
@trufurs trufurs requested a review from niraj2477 June 2, 2026 05:04
@trufurs trufurs merged commit e9bb8df into version-16 Jun 2, 2026
3 checks passed
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.

3 participants