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

Fix admin pages when group has no organization #9010

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Fix admin pages when group has no organization #9010

merged 1 commit into from
Oct 11, 2024

Commits on Oct 11, 2024

  1. Fix admin pages when group has no organization

    Fix a crash on the admin page for editing an open or restricted group
    when the group has no organization.
    
    Fixes: #9009
    
    Problem
    -------
    
    Open and restricted groups have admin pages that let Hypothesis admins
    edit the group (type, name, organization, creator, description, scopes,
    members). You go to https://hypothes.is/admin/groups, search for the
    open or restricted group that you want, and click on that group's name
    to go to the `https://hypothes.is/admin/groups/<PUBID>` admin page for
    editing that group.
    
    Private groups do not have admin pages, that's why many of the group
    names on the the https://hypothes.is/admin/groups admin page aren't
    linked: those are private groups.
    
    Originally the only way to create an open or restricted group was via
    the https://hypothes.is/admin/groups/new admin page, and that page
    forces you to choose an organization for the open or restricted group to
    belong to. The `https://hypothes.is/admin/groups/<PUBID>` page could
    therefore assume that all open or restricted groups belong to an
    organization.
    
    Recently we've enabled users to create their own open or restricted
    groups via the https://hypothes.is/groups/new page and groups created by
    this page do not have organizations. Private groups created by this page
    have never belonged to organizations. The open and restricted groups
    that can now also be created don't have organizations either. A user
    could also create a private group with no organization and then turn it
    into an open or restricted group.
    
    So for the first time it's now possible to have open and restricted
    groups with no organizations. But the
    `https://hypothes.is/admin/groups/<PUBID>` admin page for editing open
    or restricted groups has two problems with this:
    
    1. Loading the page crashes when the group has no organization
    2. The form forces groups to belong to an organization, there's no
       option for a group to not have an organization
    
    Solution
    --------
    
    This commit fixes the page to not crash when a group has no organization
    and also adds a "-- None --" option to the form's organization dropdown
    so that it no longer forces you to select an organization when creating
    or editing a group.
    
    As a side effect of these changes admins can now also use the
    https://hypothes.is/admin/groups/new admin page to create open and
    restricted groups with no organization, and some further fixes were
    needed to prevent this from crashing.
    seanh committed Oct 11, 2024
    Configuration menu
    Copy the full SHA
    916de34 View commit details
    Browse the repository at this point in the history