Fix race condition when joining rooms
Fix race condition when joining rooms

Problem: Hitting join on a room invite would show spinner, then join room screen
then the messages.

Cause: The UI to show a spinner is set via the "joining" flag. This flag was
only set for the duration of the /join HTTP request. This is insufficient
because it races with actual room info arriving from /sync. If this info does
not arrive before the /join HTTP request returns, "joining" is false but the
current membership state of the user is still invite.

Fix: The "joining" flag is still set when the /join HTTP request is made, but
it is only turned off when the join event arrives from /sync.

Extras: This fix should also work when joining a room not from an invite.

matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,aperezdc/matrix-react-sdk,aperezdc/matrix-react-sdk,aperezdc/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,aperezdc/matrix-react-sdk