FossifyOrg / Messages

An easy and quick way of managing SMS and MMS messages without ads.
https://www.fossify.org
GNU General Public License v3.0
414 stars 29 forks source link

Fix deletion of random SMS when trying to update threads #149

Open tom93 opened 3 months ago

tom93 commented 3 months ago

Commit 44c540b9 introduced a hack to update the conversation snippet, however there is a bug in that code: it tries to delete by thread ID, but the condition is applied to the SMS table, not to the threads table (Android source). So instead of deleting the thread with that ID, it deletes whichever SMS happens to have that ID.

The fix is to change the condition to an always-false condition, so that no messages will be deleted. The threads will still get updated.

Old updates **Update 1:** A minor issue with this PR is that the conversation dates don't get updated any more (the date should be updated to the last non-deleted message in the conversation, but that doesn't happen). I'm not sure why that is. **Update 2:** I think the Telephony database *is* getting updated correctly, but the app's cache isn't getting updated (probably because I [removed the call to insertOrUpdateConversation()](https://github.com/FossifyOrg/Messages/commit/fe71e4ff1bb25bb12f3e7fde66c8b3b127b409b5)). I'm looking into this, but I think this it's still worth merging and releasing as-is because deleting random messages is not good! **Update 3:** I [restored the call to insertOrUpdateConversation()](https://github.com/FossifyOrg/Messages/commit/571f9a45e2baf854447a39f8287490ec75bdb9eb) and everything seems fine now. I squashed and force-pushed.

What is it?

Description of the changes in your PR

Before/After Screenshots/Screen Record

See #148.

Fixes the following issue(s)

Acknowledgement