Skip to content

DROID-3692 Space settings | Fix | Different number of members on Space settings screen and Members screen #2450

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

Conversation

konstantiniiv
Copy link
Collaborator

@konstantiniiv konstantiniiv commented May 23, 2025


  • I understand that contributing to this repository will require me to agree with the CLA

Description

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 tech-docs
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

@konstantiniiv konstantiniiv requested a review from Copilot May 23, 2025 16:06
@konstantiniiv konstantiniiv self-assigned this May 23, 2025
@konstantiniiv konstantiniiv requested a review from uburoiubu as a code owner May 23, 2025 16:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the discrepancy in member counts shown on the Space Settings screen versus the Members screen by filtering space members based on their status and the current user’s ownership.

  • Owner users now see members with statuses ACTIVE, JOINING, or REMOVING.
  • Non-owner users see only members with status ACTIVE.
  • Updated the spaceMemberCount calculation accordingly.
Comments suppressed due to low confidence (2)

presentation/src/main/java/com/anyproto/anytype/presentation/spaces/SpaceSettingsViewModel.kt:193

  • Add unit tests to cover both owner and non-owner paths in the member count logic, ensuring correct counts for ACTIVE, JOINING, and REMOVING statuses.
if (permission?.isOwner() == true) {

presentation/src/main/java/com/anytypeio/anytype/presentation/spaces/SpaceSettingsViewModel.kt:196

  • [nitpick] Extract the status lists (e.g., OWNER_VISIBLE_STATUSES and MEMBER_VISIBLE_STATUSES) into constants or a helper function to avoid duplicating the filter logic.
spaceMembers.members.filter {

@konstantiniiv konstantiniiv requested a review from Copilot May 24, 2025 11:16
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the discrepancy in the reported number of space members between the Space settings and Members screens by updating the logic that processes space members.

  • Added GetAccount dependency and retrieval logic for better conversion in member count computations
  • Updated the member count calculation to use the toView mapping with account and permission data
  • Updated dependency injection in the DI module to provide the GetAccount use case

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
presentation/src/main/java/com/anytypeio/anytype/presentation/spaces/SpaceSettingsViewModel.kt Updated dependency injection; integrated account retrieval; changed member count calculation using toView conversion
app/src/main/java/com/anytypeio/anytype/di/feature/spaces/SpaceSettingsDI.kt Added provider for GetAccount use case

@konstantiniiv konstantiniiv merged commit e685e4e into main May 24, 2025
3 checks passed
@konstantiniiv konstantiniiv deleted the droid-3692-space-settings-fix-different-number-of-members-on-space branch May 24, 2025 12:10
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants