linagora / twake-on-matrix

A multi-platform (Flutter) application for connecting to Matrix - an open network for secure, decentralized communication, with your favorite devices.
GNU Affero General Public License v3.0
64 stars 18 forks source link

TW-1766: fix 500,404 error in POST request when login #1946

Closed sherlockvn closed 4 months ago

sherlockvn commented 4 months ago

Ticket

Related issue

1766

Root cause

If this is a bug, please provide a brief description of the root cause of the issue We create the bootstrap dialog at the wrong time, so the state of bootstrap dialog always be newSSSSKey, that means, it will call to POST request to upload new key no matter what even when you have got the recovery key success before in tom server.

Solution

Outline the implemented solution, detailing the changes made and how they address the issue The solution is direct. We move the creating bootstrap dialog after we have loaded successfully the roomData and accountData from homeserver. This will make sure that the bootstrap state is correct and will not call to upload recoveryKey everytime we log in.

Impact description

If this is not a bug, please explain how the changes affect the project Can decrypt message with new account now.

Test recommendations

Recommendations for how to test this, or anything else you are worried about?

  1. Create a new account (make sure you follow every steps)
  2. Create an encrypted chat
  3. Send some messages in encrypted chat, then wait for the messages is sent.
  4. Log out and log in again
  5. You will see that the messages in encrypted chat has been decrypted.

    Pre-merge

    Does anything else need to be done before merging? no.

    Resolved

    Attach screenshots or videos demonstrating the changes

    • Web:

https://github.com/linagora/twake-on-matrix/assets/43041967/9bde5adc-7433-431d-b508-c0776258fa99

https://github.com/linagora/twake-on-matrix/assets/43041967/76f8ea95-a6fb-44d6-b0e6-b60e3e51a2e5

github-actions[bot] commented 4 months ago

This PR has been deployed to https://linagora.github.io/twake-on-matrix/1946

Te-Z commented 4 months ago

Tested on android, chrome, edge, firefox. LGTM

hoangdat commented 4 months ago

For this ticket, please note the cases we use to test

Please add more cases, we should maintain these test case to verify problem of backup.

sherlockvn commented 4 months ago

case 1:

https://github.com/user-attachments/assets/c89ebee7-55b5-4a20-97a3-f0da4ea93fa1

sherlockvn commented 4 months ago

case 2:

https://github.com/user-attachments/assets/f6b42da9-f6fb-4c12-a8ce-258e948aa1ad

sherlockvn commented 4 months ago

case 3: import backup key from mobile

https://github.com/user-attachments/assets/bff3396b-569a-4abd-a28d-61efabcb98fb