Skip to content

Bugfix/noid/ensure successful requests after leaving chat#6333

Open
mahibi wants to merge 3 commits into
masterfrom
bugfix/noid/ensureSuccessfulRequestsAfterLeavingChat
Open

Bugfix/noid/ensure successful requests after leaving chat#6333
mahibi wants to merge 3 commits into
masterfrom
bugfix/noid/ensureSuccessfulRequestsAfterLeavingChat

Conversation

@mahibi

@mahibi mahibi commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Fix race conditions while leaving a chat room.

This might have been one reason why servers to deleted a freshly-posted notification because it might have considered to be a user still being in a room. See commit messages for further details.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

mahibi added 3 commits June 11, 2026 14:29
Move the WebSocket "leave room" signal to the start of leaveRoom() so
the HPB stops considering the user "in" the room before the backend
DELETE is even sent. This closes the window in which the HPB could
trigger the server to delete a freshly-created notification.

AI-assistant: Claude Code v2.1.142 (Claude Sonnet 4.6)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Replace the RxJava leaveRoom HTTP call with a coroutine launched on an
application-scoped CoroutineScope, so the request survives onPause and
ViewModel teardown and completes even after back-navigation.

AI-assistant: Claude Code v2.1.142 (Claude Sonnet 4.6)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Move sessionIdAfterRoomJoined reset to right after the WebSocket send
in ChatActivity.leaveRoom() - the session ID is already consumed at that
point so there's no reason to wait for the HTTP response.

Remove the leaveRoomViewState observer from ChatActivity since it's no
longer responsible for anything useful. The callback now fires directly
from the coroutine via withContext(Main), which avoids the LiveData
lifecycle gate that could silently drop it when the Activity is already
stopping.

AI-assistant: Claude Code v2.1.142 (Claude Sonnet 4.6)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi added this to the 24.1.0 milestone Jun 11, 2026
@mahibi mahibi requested a review from rapterjet2004 June 11, 2026 12:35
@mahibi mahibi self-assigned this Jun 11, 2026
@mahibi mahibi added the 3. to review Waiting for reviews label Jun 11, 2026
@mahibi

mahibi commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

For followup PRs:

  • Same pattern with application scope should also be applied to call screen when leaving it.

@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/27347136603/artifacts/7569076256
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@mahibi

mahibi commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

not backporting to 24.0. I want this to be tested a bit longer, so for 24.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant