Repository navigation
Per-event section switches - #2664
Draft
soof-golan wants to merge 8 commits into
Draft
soof-golan wants to merge 8 commits into
soof-golan wants to merge 8 commits into
Conversation
A switched-off section stays composed, so its consumers keep working, but its pages answer 404 and its nav, tiles, cards and parts are filtered out while that event is active. (cherry picked from commit 2e2eaaf)
Links resolve to the section that serves them from the app's own routes, so a link, and a wrapper marked hide-with-links, disappears with its section. (cherry picked from commit 7bcedab)
A host that renders views without it, like a section's view tests, has nothing switched off to resolve. (cherry picked from commit 8c38579)
A controller marked StaysOnWhenSectionIsOff keeps answering and keeps its links. (cherry picked from commit a3af3e4)
(cherry picked from commit 3c79919)
…ms, the helper and click-throughs (cherry picked from commit e160735)
Retention, the email outbox and the legal document sync stay on. (cherry picked from commit 27cb0d7)
EF generates the migration after RenameTablesToSectionPrefix, so it adds the column to settings_events. SectionSwitches reads the in-memory active event, and the test names follow HUM0043.
|
This PR has a merge conflict with |
2 tasks done
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.
[bot] Opened on behalf of @soof-golan (Kiez Burn e.V., which runs a fork of Humans).
What
Per-event section switches: an admin ticks sections off on the event form at
/Settings#event, and while that event is active those sections are gone — their pages answer 404, their nav, tiles, cards, parts, meters, banners and helper-index entries drop out, links into them are removed from views, and their recurring jobs are paused.Why
ISection.IsActiveturns a section off per deployment, at the cost of a code change and a deploy, and it also removes the section's services. A burn that simply doesn't use a feature this year (Cantina, Rideshare, Tickets sold elsewhere) needs something an admin can flip and flip back. Kiez Burn has run this in production since November.How it works
settings_events.SwitchedOffSections, jsonb, nullable).ISectionSwitches(Base) reads it from the in-memory active event; every event-settings write flushes it. A stored name resolves throughISectionCatalog.TryResolve, so it survives a section rename.ISection.CanBeSwitchedOff(default true) is false for Auth, Users, Gdpr, Onboarding and Settings. The save refuses those and any unknown name.SectionSwitchFilter, a global resource filter, answers 404 for a controller whose assembly is a switched-off section.[StaysOnWhenSectionIsOff]exempts one controller (Consent'sMyDataController, a member's own data page).ISectionContributionseams drop a switched-off section's entries withSwitchedOn(HttpContext).SectionLinkTagHelperdrops<a>/<form>whose target is switched off, viaSectionRoutes(derived from routed actions, so no view names a section).hide-with-linksdrops an enclosing element once all its links are gone;keep-textkeeps a link's text.SwitchedOffSectionJobsunschedules a switched-off section's recurring jobs within a minute and reschedules them when it is back. Jobs marked[StaysOnWhenSectionIsOff](retention, the email outbox, the legal document sync) keep running.Docs:
docs/features/global/section-activation.md("Per-event switches"), the Settings invariants,background-jobs.md.Existing surface checked
Reuses
ISectionContributioncomposition,ISectionCatalog,ISection.FormerNames, the event-settings form and change listener, and the Hangfire recurring-job registration. New surface:ISectionSwitches,ISection.CanBeSwitchedOff,StaysOnWhenSectionIsOffAttribute,SectionRoutes,SectionLinkTagHelper,SectionSwitchFilter,SwitchedOffSectionJobs— each is the one place its concern lives.Checklist
tier:thorough— cross-section filtering, a global filter, a tag helper over every view, and a migration.dotnet ef migrations add AddSwitchedOffSections --context SettingsDbContext. It was run with the clock set to 2026-11-20 11:54:51 (libfaketime) so its id equals the one Kiez Burn's production already recorded for the same column; the.csis byte-identical to that one, so the fork takes this file on its next merge without re-running it.mainonpeterdrier/Humans, branched off it.dotnet test Humans.slnx, plusHumans.Integration.Tests(133/133) migrating an empty database.Reviewer notes
hide-with-links/keep-textto views; the logic itself sits in a handful of files.section-activation.md): minimal-API endpoints, URLs built in script orTableModel.Link(…)columns, help/access-matrix contributions.