Skip to content

Conversation

@jmartinesp
Copy link
Member

Content

  • When a moderation action is done (kicking, banning, unbanning), reload the member list instead of trying to modify the member list Flow.
  • Ensure the Ready state is set to the flow, even if the LaunchedEffect/collectLatest scope is cancelled.

Motivation and context

The previous runActionAndWaitForMembershipChange logic wasn't really doing anything, as the modified flow was never used. This means kicking, banning or unbanning a user didn't reload the member list consistently.

Tests

In a room you're an admin/moderator:

  • Invite a couple of users. The room member list is updated.
  • Kick one of them. The list should update.
  • Then ban and unban the other. In both cases, the updates should be visible.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

The previous `runActionAndWaitForMembershipChange` logic wasn't really doing anything, as the modified flow was never used.
@jmartinesp jmartinesp requested a review from a team as a code owner September 3, 2025 14:40
@jmartinesp jmartinesp requested review from bmarty and removed request for a team September 3, 2025 14:40
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Sep 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/pCRGoN

@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.21%. Comparing base (83c72f4) to head (5b5f1db).
⚠️ Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
...s/matrix/impl/room/member/RoomMemberListFetcher.kt 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5268   +/-   ##
========================================
  Coverage    80.21%   80.21%           
========================================
  Files         2239     2239           
  Lines        61503    61507    +4     
  Branches      7791     7791           
========================================
+ Hits         49333    49337    +4     
  Misses        9314     9314           
  Partials      2856     2856           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

unbanUserAsyncAction.value = AsyncAction.ConfirmingNoParams
}
}
moderationActions.value = persistentListOf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure to understand the effect of this. It is supposed to close the bottom sheet as soon as an action is selected, to avoid that a bottom sheet is displayed at the same time as a confirmation dialog, but this is already the current behavior. Is there some other rationale?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is supposed to close the bottom sheet as soon as an action is selected, to avoid that a bottom sheet is displayed at the same time as a confirmation dialog, but this is already the current behavior.

It wasn't after I made these changes, I had to manually set it to an empty list or both the action list and the confirmation dialog would be displayed at the same time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's because the actions were computed for the user I was banning, then I tried to unban that same user, and it was displaying the previously calculated actions, which no longer apply.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks!

… if the underlying coroutine scope is no longer there.

With `emit`, the `Ready` state was not emitted if the member list was loaded way too fast.
@jmartinesp jmartinesp force-pushed the fix/reload-member-list-after-moderation-actions branch from 5e526d7 to 5b5f1db Compare September 4, 2025 12:30
@jmartinesp jmartinesp enabled auto-merge (squash) September 4, 2025 12:30
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 4, 2025

@jmartinesp jmartinesp merged commit d4d57b1 into develop Sep 4, 2025
28 of 29 checks passed
@jmartinesp jmartinesp deleted the fix/reload-member-list-after-moderation-actions branch September 4, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Bugfix For bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants