Skip to content

🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion copy#7348

Closed
ShanaLMoore wants to merge 2 commits intomainfrom
i2925-fix-contexts-bug-copy
Closed

🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion copy#7348
ShanaLMoore wants to merge 2 commits intomainfrom
i2925-fix-contexts-bug-copy

Conversation

@ShanaLMoore
Copy link
Contributor

Fixes

Summary

Bug: With HYRAX_FLEXIBLE=true, context-specific properties from the metadata profile (e.g. “dimensions” for special_context) do not appear on the work form even when the work’s admin set has that context assigned.

Cause: In Hyrax::Forms::ResourceForm#initialize, the form uses r.context (singular) to pass to form_definitions_for; the resource only has r.contexts (plural), so contexts is always nil and M3SchemaLoader omits all context-restricted properties.

PS. 5.0-flexible has it as a plural reference as well

Changes proposed in this pull request:

Fix: In resource_form.rb, use the resource’s contexts (plural) when calling form_definitions_for (e.g. context = r.respond_to?(:contexts) ? r.contexts : nil and pass it as contexts: context), so the form includes properties for the work’s context(s), e.g. “dimensions” for admin sets with “special context.”

@samvera/hyrax-code-reviewers

image image

metadata-profile-v.7 (1).yml

BEFORE

dimensions was missing from an ImageResource work created from the 'special context' admin set image

AFTER

image

Pass resource.contexts (plural) into form_definitions_for so context-specific
metadata profile properties (e.g. dimensions for special_context) appear on
the work form when the admin set has that context assigned.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Hyrax flexible metadata forms so context-restricted properties from the M3 metadata profile are included on work forms when the work/admin set has matching contexts.

Changes:

  • Update Hyrax::Forms::ResourceForm initialization to pass resource.contexts (plural) into m3_schema_loader.form_definitions_for.
  • Ensure schema-driven form field inclusion respects context filtering in Hyrax::M3SchemaLoader.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Test Results

    13 files  ±0      13 suites  ±0   2h 51m 6s ⏱️ - 2m 3s
 7 049 tests ±0   6 743 ✅ ±0  306 💤 ±0  0 ❌ ±0 
18 793 runs  ±0  18 292 ✅ ±0  501 💤 ±0  0 ❌ ±0 

Results for commit 423b002. ± Comparison against base commit 56a94e3.

This pull request removes 359 and adds 359 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007efd5a0b7300>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f1b8bdd03d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f9342fc3fc8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007efd5a0cba58>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f1b8bdd4ed0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f9342f87d20>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: d0c328e2-5c18-492a-82cc-d390be3b28d4
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 4e7abd94-369b-49c1-9ce4-1b022e6733b2
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 93a4082e-cb04-4016-954c-dffd570bf6a1
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: cb932ec5-308e-4d28-a04b-57dbf1c92154
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f0086cebb88>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f027cd9eec0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fa7c30162c0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f0086cd9118>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f027cd0eed8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fa7c2fd26d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: cf856815-7da8-4583-94f3-ed9f154dd7ef
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 21e64017-3bbb-467e-a76a-3b74aa5733fd
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: ec2ef7a3-95c7-46b8-8e52-a308e6d83cef
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 05e3734c-636e-43d3-86b5-9fcb92ae04f3
…

@ShanaLMoore ShanaLMoore changed the title 🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion 🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion copy Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant