#7201 show active custom org links in the left nav - #7206
Open
augustocbx wants to merge 2 commits into
Open
augustocbx wants to merge 2 commits into
augustocbx wants to merge 2 commits into
Conversation
augustocbx
requested review from
FireLemons,
compwron and
elasticspoon
as code owners
September 21, 2026 18:31
This branch has not been deployed
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 github issue is this PR for, if any?
Resolves #7201
What changed, and why?
Active custom org links show up in the left nav again.
Custom org links had exactly one display surface:
app/views/layouts/_sidebar.html.erb. The Tailwind redesign (#7051, ad9c149) deleted that partial together withSidebar::LinkComponentand replaced them with the inline nav inapp/views/layouts/casa_app.html.erb, which is built from a hard-codednav_groupsarray — so the render was dropped with no replacement and admin-created links stopped appearing anywhere outside the settings table they are created in.nav_groupsnow ends with aLinksgroup built fromcurrent_organization.custom_org_links.active, placed after Reporting and above the pinned Settings, rendered through the samelayouts/_nav_linkpartial as every other nav item. The group needs no special hiding logic: the existing rule that drops a group with no visible items (visible_groupsrejects empty groups) is what keeps an org with no active links from getting an orphanLINKSlabel. Links are visible to every role in the organization, which is what the original feature (#6298) shipped.Custom links are always absolute
http(s)URLs (UrlValidatorrequires a scheme and a host), so they always leave the app._nav_linkgained an optionalexternallocal that addstarget="_blank"+rel="noopener", a trailingbi-box-arrow-up-rightaffordance, and ansr-only"(opens in a new tab)" — the icon isaria-hidden, so without the text nothing announces the new tab. The label is user-supplied (30 chars max), so it is truncated instead of being allowed to widen the 256px rail.design.md(App shell → sidebar) documents the new group and the external-link variant, per the repo's design-system workflow.The unscoped lookup flagged at the bottom of the issue.
Confirmed reproducible:
CustomOrgLinksController#set_custom_org_linkdidCustomOrgLink.find(params[:id])with no org scoping, andCustomOrgLinkPolicydefines only aScope, soedit?/update?/destroy?fell through toApplicationPolicy'sis_admin?with nosame_org?check. An admin of org A could edit and destroy org B's links — the new PUT request spec failed onmainwith the other org's link actually renamed. The lookup is now scoped tocurrent_organization.custom_org_links, matching how the sibling settings controllers already do it (banners_controller.rb:67,mileage_rates_controller.rb:51,contact_type_groups_controller.rb:43), so a cross-org id is a 404.Happy to split that second commit into its own PR if you would rather track it separately.
How is this tested? (please write rspec and jest tests!) 💖💪
New
spec/system/layouts/custom_org_links_nav_spec.rb, for volunteer, supervisor and casa admin: the org's active link is in the main nav, it carriestarget="_blank"+rel="noopener", and inactive links and other orgs' links are not rendered — plus an org with no active links renders noLinksgroup at all. All four examples per role fail onmain.spec/models/custom_org_link_spec.rbcovers the new.activescope.spec/requests/custom_org_links_spec.rbadds an "admin of another organization" context to edit/update/destroy (404, record unchanged, count unchanged); those three examples fail without the controller change. The existing edit examples were usingsign_in_as_adminplus an unrelated-org link — they now use the org-consistentcasa_admin/volunteerlets the rest of the file already uses.No JavaScript changed, so there is nothing new for jest here.
Screenshots please :)
Local server, seeded data, two active custom links ("Volunteer handbook", "Mileage policy") on Prince George CASA.
Signed in as
casa_admin1@example.comathttp://localhost:3000/casa_cases—LINKSsits afterREPORTINGand above the pinnedSettings:Signed in as
volunteer1@example.comathttp://localhost:3000/case_contacts— the same links, and no Settings item (still policy-gated):