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

Exclude revoked public links from tab count #1013

Merged
merged 2 commits into from
Jul 26, 2024
Merged

Conversation

matthew-white
Copy link
Member

@matthew-white matthew-white commented Jul 25, 2024

This PR makes a fix related to getodk/central#671 (comment). As returned by Backend, form.publicLinks is the number of active public links, which excludes revoked public links. However, once the publicLinks list is received, Frontend updates form.publicLinks to match publicLinks.length, which will include revoked links. Updating form.publicLinks like this is intended to keep the count up-to-date and consistent. For example, it means that when a public link is created, the count shown in the tab will automatically increase. That said, we do need to exclude revoked links when updating form.publicLinks to match publicLinks.

What has been done to verify that this works as intended?

New tests.

Why is this the best possible solution? Were any other approaches considered?

I originally thought this was an issue in PublicLinkRevoke and that we needed to decrement form.publicLinks in that component. That didn't turn out to be correct: once a public link is revoked, publicLinks is refreshed, and that alone should update form.publicLinks. That's how creating a public link works in PublicLinkCreate. All we need to do is exclude revoked links when reconciling form.publicLinks and publicLinks.

That said, when I thought the issue was with PublicLinkRevoke, I did take the step of converting the component to Composition API. I want to do that for more components, so I think that's a change worth keeping, and I've included it with the PR.

Before submitting this PR, please make sure you have:

  • run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

@matthew-white matthew-white merged commit dae392b into master Jul 26, 2024
1 check passed
@matthew-white matthew-white deleted the revoke-decrement branch July 26, 2024 02:21
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.

2 participants