Skip to content
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

Show "Leave group" option for open and restricted groups that user is a member of #6638

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

robertknight
Copy link
Member

Previously the "Leave group" option was only shown for private groups on the basis that membership of open and restricted groups was managed by h admins. However first-party Hypothesis users can now create open and restricted groups themselves and members of these groups will see an option to leave the group on activity pages. Align whether the client shows the "Leave group" option with h's behavior.

During this change it was noticed that the documentation in the code and test descriptions did not match the actual handling of allowLeavingGroups. The comments said that services had to explicitly set allowLeavingGroups to prevent users leaving. However the code would treat allowLeavingGroups as false if a) service configuration was present and b) the value of allowLeavingGroups was falsey (including undefined). Changing this behavior may cause issues for existing users of third party authorities, so this commit updates the documentation and tests to accurately describe the current behavior.

Fixes #6637 (Slack thread)


Testing:

  1. Create an open group at http://localhost:5000/groups/new
  2. Verify that you see the "Leave group" option on activity pages
  3. On the main branch in the client, the new group will appear in the drop-down menu but the "Leave group" option will be missing
  4. On this branch the "Leave group" option should be present and work when clicked

… a member of

Previously the "Leave group" option was only shown for private groups on the
basis that membership of open and restricted groups was managed by h admins.
However first-party Hypothesis users can now create open and restricted groups
themselves and members of these groups will see an option to leave the group on
activity pages. Align whether the client shows the "Leave group" option with h's
behavior.

During this change it was noticed that the documentation in the code and test
descriptions did not match the actual handling of `allowLeavingGroups`. The
comments said that services had to explicitly set `allowLeavingGroups` to
prevent users leaving. However the code would treat `allowLeavingGroups` as false
if a) service configuration was present and b) the value of `allowLeavingGroups`
was falsey (including undefined). Changing this behavior may cause issues for
existing users of third party authorities, so this commit updates the
documentation and tests to accurately describe the current behavior.

Fixes #6637
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.42%. Comparing base (67b74ce) to head (600b3fe).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6638      +/-   ##
==========================================
- Coverage   99.42%   99.42%   -0.01%     
==========================================
  Files         270      270              
  Lines       10174    10172       -2     
  Branches     2419     2418       -1     
==========================================
- Hits        10116    10114       -2     
  Misses         58       58              

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

Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

I tested it and works as expected. In main branch I did not see the option to leave group for non-private groups, but I do see it in this branch.

@robertknight robertknight merged commit d14c255 into main Oct 30, 2024
4 checks passed
@robertknight robertknight deleted the allow-users-to-leave-open-groups branch October 30, 2024 14:31
robertknight added a commit that referenced this pull request Oct 30, 2024
Update the documentation to match the current behavior. As noted in
#6638, the code comments and behavior
were inconsistent. Since changing the behavior is potentially disruptive, that
PR changed the comments instead. This commit updates the publisher-facing
documentation.
robertknight added a commit that referenced this pull request Oct 30, 2024
Update the documentation to match the current behavior. As noted in
#6638, the code comments and behavior
were inconsistent. Since changing the behavior is potentially disruptive, that
PR changed the comments instead. This commit updates the publisher-facing
documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Groups menu does not show "Leave group" option for non-private groups
2 participants