fix(email): clean up reply draft when the body is emptied#4286
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughIn 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
hasDraftContent counted the auto-derived reply recipients, so clearing a reply's body left an empty draft behind instead of deleting it. The reply path now omits recipients from the content check; compose still counts user-entered recipients.
89ace92 to
d166b89
Compare
The delete-draft mutation invalidated the soup entity by draft-message id, but email soup entities are keyed by thread id, so it was a no-op and the drafts tab stayed stale until a manual refresh. Pass the thread id and refetch the thread entity (mirroring the save path), flipping its is_draft flag so the thread leaves the drafts tab while remaining in the inbox.
2d09536 to
74a4d40
Compare
Emptying a reply's body left an empty draft behind because
hasDraftContentcounted the auto-derived reply recipients as content, socollectDraftnever returned null and the draft was re-saved instead of deleted. The reply path now omits recipients from the content check (compose still counts user-entered recipients), so clearing a reply deletes its draft. Verified in-app: typing creates a draft, clearing the body removes it.