feat: restore messages to original folder when unmarked as spam#236
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where messages unmarked as spam were always moved to the Inbox, regardless of their original location. By introducing a mechanism to track the message's original folder, the system can now accurately restore messages to their correct previous mailbox, improving user experience and maintaining mail organization. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a useful feature to restore messages to their original folder when they are unmarked as spam. The implementation correctly adds a previous_mailbox_id column to the database, includes a migration for existing installations, and adds new tests to verify the behavior. However, I've identified some critical and high-severity issues related to error handling. In both the database migration logic and the message restoration logic, potential database errors are silently ignored. This could lead to an inconsistent database state or incorrect behavior (like falling back to INBOX) without any logs or warnings. I have provided specific suggestions to ensure these errors are properly handled and logged.
|
@MohamadNazik Could you please resolve the Gemini reviews? |
- Fix error handling in DB migration logic to prevent silent failures - Add logging for database query errors during message restoration - Consolidate spam restoration tests into store_test.go - Add descriptive documentation comments to the new test cases
|
@Aravinda-HWK |
Hi @MohamadNazik I removed the migration because we are not in production level. No need for that. |
* feat: restore messages to original folder when unmarked as spam * refactor: address PR review comments for spam restoration logic - Fix error handling in DB migration logic to prevent silent failures - Add logging for database query errors during message restoration - Consolidate spam restoration tests into store_test.go - Add descriptive documentation comments to the new test cases * refactor: remove migration logic for previous_mailbox_id column in createMessageMailboxTable --------- Co-authored-by: Aravinda-HWK <aravinda.20@cse.mrt.ac.lk>
📌 Description
This PR fixes the issue where emails marked as "Not Spam" were always moved to the Inbox, regardless of their original folder. We now track the source folder ID before a message is moved to Spam, allowing it to be properly restored to its correct location (e.g., Sent) when unmarked.
🔍 Changes Made
✅ Checklist (Email System)
LOGIN,CAPABILITY,LIST,SELECT,FETCH,LOGOUT).🧪 Testing Instructions
To verify the fix locally:
📷 Screenshots / Logs (if applicable)
(No response)