Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VACMS-17018 Resolve VAMC menu assignment issues. #16994

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

swirtSJW
Copy link
Contributor

@swirtSJW swirtSJW commented Jan 24, 2024

Description

Relates to #17018 (or closes?)

Testing done

Screenshots

QA steps

What needs to be checked to prove this works?
What needs to be checked to prove it didn't break any related things?
What variations of circumstances (users, actions, values) need to be checked?

As user RS (VAMC Content creator and content publisher in one VAMC health system section)

  1. Go to https://pr16994-ksy8sixki8oyk0owsscsp9ijgfxn7pfi.ci.cms.va.gov/node/5579/edit
    • Validate that the menu parent is "Work with us" and is not locked
    • Validate that you can save the node successfully.
  1. Test creating new Go to https://pr16994-ksy8sixki8oyk0owsscsp9ijgfxn7pfi.ci.cms.va.gov/node/add/health_care_region_detail_page
    • Validate that you can not pick "Work with us" as a menu parent option.
    • fill out all required fields
    • Validate it can be saved when some other parent choice is made.
  2. Edit the page you just created and set the menu parent to "Select a value".
    • Validate that php validation prevents the save
    • Validate that you are able to select parent after the failed save. (This was an existing defect, separate from this work.)

Definition of Done

  • Documentation has been updated, if applicable.
  • Tests have been added if necessary.
  • Automated tests have passed.
  • Code Quality Tests have passed.
  • Acceptance Criteria in related issue are met.
  • Manual Code Review Approved.
  • If there are field changes, front end output has been thoroughly checked.

Select Team for PR review

  • CMS Team
  • Public websites
  • Facilities
  • User support
  • Accelerated Publishing

Is this PR blocked by another PR?

  • DO NOT MERGE

Does this PR need review from a Product Owner

  • Needs PO review

CMS user-facing announcement

Is an announcement needed to let editors know of this change?

  • Yes, and it's written in issue ____ and queued for publication.
    • Merge and ping the UX writer so they are ready to publish after deployment
  • Yes, but it hasn't yet been written
    • Don't merge yet -- ping the UX writer to write and queue content
  • No announcement is needed for this code change.
    • Merge & carry on unburdened by announcements

@swirtSJW swirtSJW self-assigned this Jan 24, 2024
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 24, 2024 01:36 Destroyed
@@ -80,4 +80,5 @@ function va_gov_media_clientside_validation_validator_info_alter(&$validators) {
foreach ($validators as &$validator) {
$validator['attachments']['library'][] = 'va_gov_media/cv.alt-text.validate';
}
unset($validator);
}
Copy link
Contributor Author

@swirtSJW swirtSJW Jan 24, 2024

Choose a reason for hiding this comment

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

This is necessary to avoid the first pink warning on this page
https://www.php.net/manual/en/control-structures.foreach.php

A foreach by reference, must close the barn door by unsetting the referenced variable.

This was causing the last validation in the list of validations to appear twice, and get executed that way.

@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 24, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 24, 2024
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 24, 2024 06:41 Destroyed
@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 24, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 24, 2024
Copy link
Contributor

@omahane omahane left a comment

Choose a reason for hiding this comment

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

All but one of the pages check out.

Can you confirm whether it should be locked or not?

Validate Womens Veteran care https://pr16994-ksy8sixki8oyk0owsscsp9ijgfxn7pfi.ci.cms.va.gov/node/3084/edit is not locked.

Result

Screenshot 2024-01-24 at 8 40 58 AM

@swirtSJW
Copy link
Contributor Author

Sorry, bad copy paste. This is compared to a 2 month old training environment. It should be locked
image

@swirtSJW
Copy link
Contributor Author

swirtSJW commented Jan 24, 2024

There is one functional change coming out of this, but it is actually more in alignment with what shoud be happening.
image

EDIT: this is no longer an issue. I have restored the functionality to exactly match what we had before.

@swirtSJW
Copy link
Contributor Author

swirtSJW commented Jan 24, 2024

There is a regression though that should not be allowed in. One more fix needed
image

EDIT: this is no longer an issue. I have restored the functionality to exactly match what we had before.

@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 24, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 24, 2024
@swirtSJW swirtSJW changed the title VACMS-0000 Save test VACMS-17018 Resolve VAMC menu assignment issues. Jan 24, 2024
@swirtSJW swirtSJW force-pushed the VACMS-16959-fix-work-with-us-menu-lock branch from 124c170 to ffcdcfc Compare January 24, 2024 22:41
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 24, 2024 22:41 Destroyed
@swirtSJW swirtSJW requested a review from omahane January 24, 2024 22:43
@swirtSJW swirtSJW marked this pull request as ready for review January 24, 2024 22:57
// to be enabled.
$menu_element_type = self::ENABLED;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reverted temporary fix from #16975

@@ -624,7 +620,7 @@ protected function preventUnintendedChangeOfParent(array &$form) {
return;
}
// This is not new so check the current parent exists in the reduced form.
elseif (!$current_menu_item_is_present || $this->isCurrentMenuSettingDisabled($form)) {
elseif (!$current_menu_item_is_present || $this->isCurrentMenuParentDisabledAndLocked($form)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renaming to make more accurate.

@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@swirtSJW swirtSJW added Facilities Facilities products (VAMC, Vet Center, etc) CMS Team CMS Product team that manages both editor exp and devops labels Jan 25, 2024
@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@swirtSJW swirtSJW force-pushed the VACMS-16959-fix-work-with-us-menu-lock branch from ffcdcfc to 7ec149a Compare January 25, 2024 13:19
@swirtSJW swirtSJW requested review from edmund-dunn and a team and removed request for a team January 25, 2024 14:05
@omahane
Copy link
Contributor

omahane commented Jan 25, 2024

Existing defect: Selecting "- Select a value -" in Parent link

Note: I think this is a highly unlikely scenario.

Staging:

Saving as draft

  • If the page is under "Work with us":
    • Change **Parent link" to "- Select a value -"
    • Choose "Draft" under Save as
    • Click Save
    • PHP validation throws: "1 error has been found: Parent link (Can not be changed.)"
    • Parent link, now labeled Parent link (Can not be changed.) is disabled with "- Select a value -" shown as selected
    • Underneath Parent link (Can not be changed.) it reads "You can only change the parent menu link for the published version of this content."
    • Change Save as to "Published"
    • Click Save
    • Node is saved under "Work with us"

Saving as published

  • If the page is under "Work with us":
    • Change **Parent link" to "- Select a value -"
    • Choose "Published" under Save as
    • Click Save
    • PHP validation throws: "1 error has been found: Parent link (Can not be changed.)"
    • Parent link, now labeled Parent link (Can not be changed.) is disabled with "- Select a value -" shown as selected
    • Underneath Parent link (Can not be changed.) it reads "Menu parent item cannot be empty."
    • Click Save
    • Node is saved under "Work with us"

Summary

The current defect is mostly in the presentation of the value in the Parent Link field, as saving with "- Select a value -" ultimately results in no change, though the error message and the disabled state and value of the Parent link are misleading and would likely cause an editor to back out of the change by closing the window or refreshing the page.

PR env:

Saving as draft

  • If the page is under Work with us:
    • Change **Parent link" to "- Select a value -"
    • Choose "Draft" under Save as
    • Click Save
    • PHP validation throws: "1 error has been found: [Parent link]"
    • Parent link, now labeled Parent link is still enabled with "- Select a value -" shown as selected
    • Underneath Parent link it reads "You can only change the parent menu link for the published version of this content."
    • Though Parent link is still enabled, and the page can be moved under a child of Work with us, it cannot be placed under Work with us, where it belongs.
    • Change Save as to "Published"
    • Click Save
    • PHP validation throws: "1 error has been found: [Parent link]"
    • Underneath Parent link it reads "Menu parent item cannot be empty."

Saving as published

  • If the page is under "Work with us":
    • Change **Parent link" to "- Select a value -"
    • Choose "Published" under Save as
    • Click Save
    • PHP validation throws: "1 error has been found: Parent link"
    • Parent link, now labeled Parent link is still enabled with "- Select a value -" shown as selected
    • Underneath Parent link it reads "Menu parent item cannot be empty."
    • Though Parent link is still enabled, and the page can be moved under a child of Work with us, it cannot be placed under Work with us, where it belongs.
    • Click Save
    • PHP validation throws: "1 error has been found: [Parent link]"
    • Underneath Parent link it reads "Menu parent item cannot be empty."

Summary

The new defect does actually prevent the saving the node under "Work with us" if the editor has chosen "- Select a value -". However, similarly to the above, this would likely cause an editor to back out of the change by closing the window or refreshing the page.

@omahane
Copy link
Contributor

omahane commented Jan 25, 2024

Validate Whole health https://pr16994-ksy8sixki8oyk0owsscsp9ijgfxn7pfi.ci.cms.va.gov/node/59861/edit is locked

This one is not locked, and I'm not sure why it would be. It's under Programs. That doesn't appear to exclude children in VAMC Menu Custom Access

Copy link
Contributor

@omahane omahane left a comment

Choose a reason for hiding this comment

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

@swirtSJW All QA but one checks out. "Whole health" was not locked, but I don't think that it should be. Please confirm.

Regarding the defect, I have already commented. To reiterate, I think it's an edge case and neither the current behavior or the new behavior is likely preferred. I leave it to you to decide the appropriate next step.

@swirtSJW
Copy link
Contributor Author

Validate Whole health https://pr16994-ksy8sixki8oyk0owsscsp9ijgfxn7pfi.ci.cms.va.gov/node/59861/edit is locked

This one is not locked, and I'm not sure why it would be. It's under Programs. That doesn't appear to exclude children in VAMC Menu Custom Access

Yep it was a faulty QA step. Confirmed with old demo environment I updated the QA step to reflect that.
image

@swirtSJW
Copy link
Contributor Author

swirtSJW commented Jan 25, 2024

@swirtSJW
Regarding the defect, I have already commented. To reiterate, I think it's an edge case and neither the current behavior or the new behavior is likely preferred. I leave it to you to decide the appropriate next step.

That is a really good find. I think the draft tramples on things because there is contrib validation that will not allow change of menu with a draft when there is a published revision because menus didn't have revisions and workflow for a draft to associate with. So changing a menu on a draft save of a published is never possible, but I think the error messages might be trampling on each other and the lock state gets confused.
image

As you say, neither the existing or the new experience are ideal.
I have to ponder this one a bit more.

@swirtSJW
Copy link
Contributor Author

swirtSJW commented Jan 25, 2024

@omahane I think the behaviour / bug of the draft -> published empty -> to not being able to put the page back where it belongs is ok. It prevents anything bad from happening AND still does not allow them to move the page.

As you said, this is a really slim edge case. There is a way where the form could look at the form_state to see what the value used to be, then allow that value, but there would be almost no way to detect it happening and only look up the default revision if needed. It would need to consult the default revision every time and I don't want to entangle that fix into this one.

This edge case defect is unlikely and tricky but right now it favors data protection and is less broken than it was where the field became locked just by setting it to empty and trying to save.

Created new defect ticket #17032

@omahane omahane self-requested a review January 25, 2024 16:00
Copy link
Contributor

@omahane omahane left a comment

Choose a reason for hiding this comment

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

QA checks out. I like the comments about the client-side validation, as this is such a narrow needle to thread.

Copy link
Contributor

@edmund-dunn edmund-dunn left a comment

Choose a reason for hiding this comment

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

Nice work!

@va-cms-bot va-cms-bot added the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@github-actions github-actions bot removed the refresh-tugboat-cache Used by GHA Tugboat automation label Jan 25, 2024
@swirtSJW
Copy link
Contributor Author

image

@swirtSJW swirtSJW force-pushed the VACMS-16959-fix-work-with-us-menu-lock branch from 7ec149a to bd08d10 Compare January 25, 2024 18:30
@swirtSJW swirtSJW merged commit f8508b2 into main Jan 25, 2024
14 checks passed
@swirtSJW swirtSJW deleted the VACMS-16959-fix-work-with-us-menu-lock branch January 25, 2024 18:31
@va-cms-bot va-cms-bot temporarily deployed to Tugboat January 25, 2024 18:31 Destroyed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMS Team CMS Product team that manages both editor exp and devops Facilities Facilities products (VAMC, Vet Center, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants