Exclude revoked public links from tab count #1013
Merged
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.
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 thepublicLinks
list is received, Frontend updatesform.publicLinks
to matchpublicLinks.length
, which will include revoked links. Updatingform.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 updatingform.publicLinks
to matchpublicLinks
.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 decrementform.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 updateform.publicLinks
. That's how creating a public link works inPublicLinkCreate
. All we need to do is exclude revoked links when reconcilingform.publicLinks
andpublicLinks
.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:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes