department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
79 stars 59 forks source link

Fix: VA forms are incorrectly showing up in VBA and VACO sections #12933

Open jilladams opened 1 year ago

jilladams commented 1 year ago

Describe the defect

Certain Section listings are showing certain content that they shouldn't.

Content Manager views built based on Section permissions are showing content with a different Section. e.g. VBA section view is showing Forms content with the Octo Section.

User story

As an editor I want to see only content that I can edit, in my editor views so that I don't mess with things I can't / shouldn't touch.

To Reproduce

Steps to reproduce the behavior:

  1. Go to VBA Editor dashboard
  2. See Forms listed
  3. Go to VACO Editor dashboard
  4. See Forms listed

For a specific example form:

  1. Go to VBA Editor dashboard, Filter by Content Type = VA Form
  2. Click through to a listed Form, e.g. https://prod.cms.va.gov/node/5714/edit
  3. Under Section, see Section is OCTO > Sitewide > Forms

Screenshots

Forms appear in VBA section

VBA___VA_gov_CMS

Section listed on example form

Screen Shot 2023-02-16 at 11 53 18 AM

Additional context

Root cause analysis: https://github.com/department-of-veterans-affairs/va.gov-cms/issues/9469#issuecomment-1464402697

Preferred fix: Views filter - Large (5ish points, but: less tech debt)

Ideally, we could filter out certain fields from the section listings by way of configuration in Views. This would require one of several possible solutions, including either adding a field filter (no such filter is provided by the taxonomy_entity_index module), enhancing the existing argument code to do such filtering (probably not recommended as this would also hide the filtering logic)

Side effects with this approach:

We can then upstream these changes to the module, for the community.

Test case On Facilities, Field Office & Field Administration behave in a similar fashion. Editing a Facility's Field Office value to something other than the Section on the same node, will cause that Facility to appear in two different sections.

ACs

CMS Team

Please check the team(s) that will do this work.

chri5tia commented 1 year ago

I am not clear how/who assigns the section in the first place. This would help me understand the whole workflow and architecture before adding the filter programmatically.

dsasser commented 1 year ago

VA Forms are created by the migration config migrate_plus.migration.va_node_form.yml in va_gov_migrate. Both the fields, field_administration and field_va_form_administration, are defined in this migration config, and get their values from this migration.

chri5tia commented 1 year ago

Solution to edit the taxonomy view should be a simple as adding a relationship for the field_va_form_administration field, then adding a context for the same. If this taxonomy view was used as a page (page is disabled, it's a block somehow), the context for the field to exclude should be configured to "provide default value" using "Content ID from URL". Under validation, there should be an option for Content and somewhere more stuff to choose from, should be able to select "Exclude". That context using the ID in the URL might still work.

But, this exclusion basically ended up invalidating the entire query. Still trying to figure out how to exclude the field and how the filter could be created at the contrib module level.

If we want to filter out field_va_form_administration from the taxonomy index entity table then what is the point of putting it there in the first place e.g. why are we using it as an entity? Daniel described this in solution 2, which I'm starting to really think about.