hypothesis / client

The Hypothesis web-based annotation client.
Other
642 stars 197 forks source link

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

Closed robertknight closed 3 weeks ago

robertknight commented 3 weeks ago

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 https://github.com/hypothesis/client/issues/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
codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.