status-go icon indicating copy to clipboard operation
status-go copied to clipboard

fix(messenger): don't remove inactive chats when syncing

Open 0x-r4bbit opened this issue 3 years ago • 2 comments
trafficstars

This commit ensures we're relying on chat.DeletedAtClockValue instead of chat.Active to know whether or not we need to remove the chat from paired devices.

Because we were relying on Active != true, we ended up with a serious bug that would result in deactivating all chats on paired devices.

The reason the chats would disappear on paired devices is because, when setting up a new device by importing a seedphrase, chances are this device will receive HandleBackUp signals (which originate from other devices with the same account that backed up contacts etc).

When backups are handled, we create chats for every contact that's part of the backup signal. Those chats are set to Active = false because the signal handling shouldn't cause those chats to show up in the UI.

However, because those are set to Active = false, the next time the user tries to sync from this devices, all those chats are considered as "removed", hence sending "chat removed" signals when syncing (which then causes those chats to disappear on all paired devices.

We need to rely on DeletedAtClockValue to know whether a chat was indeed removed and only then emit such a signal.

0x-r4bbit avatar Aug 24 '22 12:08 0x-r4bbit

Pull Request Checklist

  • [ ] Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • [ ] Have you tested changes with mobile?
  • [ ] Have you tested changes with desktop?

status-github-bot[bot] avatar Aug 24 '22 12:08 status-github-bot[bot]

Jenkins Builds

Click to see older builds (12)
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: d8f48d06 #1 2022-08-24 12:11:52 ~2 min linux :package:zip
:heavy_check_mark: d8f48d06 #1 2022-08-24 12:13:05 ~3 min ios :package:zip
:heavy_check_mark: d8f48d06 #1 2022-08-24 12:14:13 ~4 min android :package:aar
:heavy_check_mark: 726aac78 #2 2022-08-24 12:15:12 ~3 min linux :package:zip
:heavy_check_mark: 726aac78 #2 2022-08-24 12:15:26 ~2 min ios :package:zip
:heavy_check_mark: 726aac78 #2 2022-08-24 12:17:18 ~3 min android :package:aar
:heavy_check_mark: a9c7820c #3 2022-08-24 15:24:49 ~5 min ios :package:zip
:heavy_check_mark: a9c7820c #3 2022-08-24 15:25:53 ~6 min linux :package:zip
:heavy_check_mark: a9c7820c #3 2022-08-24 15:28:10 ~9 min android :package:aar
:heavy_check_mark: a9c7820c #5 2022-08-25 09:00:53 ~1 min linux :package:zip
:heavy_check_mark: a9c7820c #5 2022-08-25 09:01:28 ~2 min ios :package:zip
:heavy_check_mark: a9c7820c #5 2022-08-25 09:02:50 ~3 min android :package:aar
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: 905210f9 #4 2022-08-24 15:26:56 ~2 min ios :package:zip
:heavy_check_mark: 905210f9 #4 2022-08-24 15:30:31 ~4 min linux :package:zip
:heavy_check_mark: 905210f9 #4 2022-08-24 15:35:22 ~7 min android :package:aar
:heavy_check_mark: c31056ec #6 2022-08-25 09:04:04 ~1 min linux :package:zip
:heavy_check_mark: c31056ec #6 2022-08-25 09:04:36 ~2 min ios :package:zip
:heavy_check_mark: c31056ec #6 2022-08-25 09:06:04 ~3 min android :package:aar

status-im-auto avatar Aug 24 '22 12:08 status-im-auto