Allow hiding instances from the admin instance chooser#266
Open
bbliem wants to merge 1 commit into
Open
Conversation
Add an is_hidden boolean field on InstanceConfig that omits an instance from the admin "Choose instance" chooser. The hiding is listing-only: the chooser menu filters out hidden instances (except the currently-active realm, so a user on a hidden instance can still switch away), while get_adminable_instances() -- the authorization gate for direct switching -- is left untouched, so hidden instances remain reachable directly and via permissions. Includes the migration and tests covering omission, the active-realm escape hatch, and preserved reachability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an
is_hiddenflag onInstanceConfigthat omits an instance from the admin "Choose instance" chooser. The hiding is listing-only: a hidden instance stays fully reachable directly (by URL / hostname / identifier) and via permissions — it is just removed from the chooser menu.Why
The instance chooser can accumulate a lot of noise (e.g., instances migrated to other clusters), especially for superusers who see every instance. This gives us a way to declutter the list without changing who can access what.
How
nodes/models.py— new field onInstanceConfig(next tois_locked):nodes/migrations/0050_instanceconfig_is_hidden.py— generated migration.admin_site/wagtail_hooks.py—InstanceChooserMenu.menu_items_for_requestnow filters outis_hiddeninstances, except the currently-active realm, so a user who is on a hidden instance still sees it and can switch away. Crucially, this filters the listing only —get_adminable_instances(), the authorization gate used by thechange_admin_instanceview, is left untouched, which is what preserves direct reachability.admin_site/tests.py— three tests:user_is_admin_for_instance/get_adminable_instancesstill include it).Setting the flag
There is no admin form for this yet; set it from the shell:
.update()(rather than.save()) is the safe choice for a programmatic field flip and avoids triggering a Wagtail revision.Out of scope
availableInstances(hostname)GraphQL query is not affected.Related issue
Asana task
✅ Pre-Merge Checklist
Type of Change
Testing
Internationalization & Accessibility