Skip to content

Change : RoomMember moderation #4779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 3, 2025
Merged

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented May 26, 2025

Content

Extract and rework the RoomMember moderation bottomsheet so you can kick, ban/unban a user/member

  • from the timeline
  • from the room member list

Now the BottomSheet will always be displayed, even if the only available action is "View profile".
If you have the power level to kick/ban, the action will be displayed, either enabled or disabled, following the other member power level. In case the other member can't be fetched (in big public room it can be very slow), then we assume we have the power to do the actions.

We'll probably add some actions later, so maybe the name Moderation will be changed.

Motivation and context

Closes #4555

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

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

@ganfra ganfra added the PR-Change For updates to an existing feature label May 26, 2025
@ganfra ganfra changed the title Feature : RoomMember moderation Change : RoomMember moderation May 26, 2025
@ganfra ganfra marked this pull request as ready for review May 26, 2025 12:56
@ganfra ganfra requested a review from a team as a code owner May 26, 2025 12:56
@ganfra ganfra requested review from bmarty and removed request for a team May 26, 2025 12:56
@ganfra ganfra added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label May 26, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label May 26, 2025
@ElementBot
Copy link
Collaborator

ElementBot commented May 26, 2025

Warnings
⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L5 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L25 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L203 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L208 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L237 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L357 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L5 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L25 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L203 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L208 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L237 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L357 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

Generated by 🚫 dangerJS against 24c29c5

Copy link
Contributor

github-actions bot commented May 26, 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/AifK5v

Copy link

codecov bot commented May 26, 2025

Codecov Report

Attention: Patch coverage is 88.77551% with 33 lines in your changes missing coverage. Please review.

Project coverage is 80.37%. Comparing base (be2d83b) to head (24c29c5).
Report is 28 commits behind head on develop.

Files with missing lines Patch % Lines
...mmembermoderation/impl/RoomMemberModerationView.kt 84.12% 2 Missing and 8 partials ⚠️
...ermoderation/impl/RoomMemberModerationPresenter.kt 91.08% 0 Missing and 9 partials ⚠️
...ration/impl/DefaultRoomMemberModerationRenderer.kt 0.00% 7 Missing ⚠️
...ndroid/features/messages/impl/MessagesPresenter.kt 60.00% 2 Missing ⚠️
.../api/timeline/item/event/ProfileTimelineDetails.kt 33.33% 1 Missing and 1 partial ⚠️
...oomdetails/impl/members/RoomMemberListPresenter.kt 80.00% 1 Missing ⚠️
...res/roomdetails/impl/members/RoomMemberListView.kt 50.00% 0 Missing and 1 partial ⚠️
.../impl/InternalRoomMemberModerationStateProvider.kt 98.21% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4779      +/-   ##
===========================================
- Coverage    80.42%   80.37%   -0.06%     
===========================================
  Files         2144     2149       +5     
  Lines        56771    56855      +84     
  Branches      7120     7128       +8     
===========================================
+ Hits         45660    45696      +36     
- Misses        8674     8713      +39     
- Partials      2437     2446       +9     

☔ 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 and tested OK using the CI build. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I do not see such disabled state on the Figma. Is it OK?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's not designed but this has been discussed in the room.


dependencies {
implementation(projects.libraries.architecture)
implementation(projects.libraries.designsystem)
Copy link
Member

Choose a reason for hiding this comment

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

I think this dependency can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it's used

dependencies {
implementation(projects.libraries.architecture)
implementation(projects.libraries.designsystem)
implementation(projects.libraries.uiStrings)
Copy link
Member

Choose a reason for hiding this comment

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

I think this dependency can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it's used

@@ -0,0 +1,21 @@
/*
* Copyright 2025 New Vector Ltd.
Copy link
Member

Choose a reason for hiding this comment

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

2025? There are other new files with 2024. This is maybe because some files has been moved and git see them as new files and previous files as deleted files?

Copy link
Member Author

@ganfra ganfra Jun 3, 2025

Choose a reason for hiding this comment

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

I think it should be 2025 for all files in this module, as I've rewritten all the code in the end.

}
if (canBan) {
if (membership == RoomMembershipState.BAN) {
add(ModerationActionState(action = ModerationAction.UnbanUser, isEnabled = canModerateThisUser))
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I have forgotten: the code coverage is decreasing a bit, maybe cover this line by a unit test?

@ganfra ganfra enabled auto-merge June 3, 2025 10:06
@ganfra ganfra added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jun 3, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jun 3, 2025
Copy link

sonarqubecloud bot commented Jun 3, 2025

@ganfra ganfra merged commit 4539474 into develop Jun 3, 2025
28 of 29 checks passed
@ganfra ganfra deleted the feature/fga/user_moderation_bottomsheet branch June 3, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Change For updates to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Show manage member sheet by tapping on member's name in the timeline
3 participants