Skip to content

Move webformsEnabled to form_defs#1840

Open
sadiqkhoja wants to merge 3 commits into
getodk:masterfrom
sadiqkhoja:features/web-form-setting-at-def-level
Open

Move webformsEnabled to form_defs#1840
sadiqkhoja wants to merge 3 commits into
getodk:masterfrom
sadiqkhoja:features/web-form-setting-at-def-level

Conversation

@sadiqkhoja
Copy link
Copy Markdown
Contributor

@sadiqkhoja sadiqkhoja commented Jun 1, 2026

Towards getodk/central#1693

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

Added tests + manual testing with corresponding changes in frontend code.

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

First commit had an approach where webformsEnabled column was only in form_defs but the resulting code was quite complicated. Latest approach follows similar pattern that of enketoId.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

Yes

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass, or witnessed Github completing all checks with success
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@sadiqkhoja sadiqkhoja force-pushed the features/web-form-setting-at-def-level branch 5 times, most recently from a166d35 to 1e2183a Compare June 2, 2026 17:10
Comment thread lib/resources/forms.js Outdated

const defFromRequest = Form.Def.fromApi(body);

await Forms._updateDef(form.def, defFromRequest);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Add audit log

matthew-white

This comment was marked as duplicate.

Copy link
Copy Markdown
Member

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

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

Just a random thing I noticed while looking at the PR

Comment thread lib/resources/forms.js Outdated
Comment on lines +257 to +260
await Forms._updateDef(form.def, defFromRequest);

const webformsEnabled = defFromRequest.webformsEnabled ?? form.def.webformsEnabled;
return { ...form.forApi(), webformsEnabled };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think that updatedAt should change as part of this endpoint? Only forms has an updatedAt column, not form_defs, but I think (not sure) that we bump updatedAt when we change the form draft. My instinct is that updatedAt should change, but it means that this pattern of { ...form.forApi(), webformsEnabled } won't work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right

@sadiqkhoja sadiqkhoja force-pushed the features/web-form-setting-at-def-level branch 4 times, most recently from 2ad22af to 25a28a5 Compare June 3, 2026 20:38
@sadiqkhoja sadiqkhoja marked this pull request as ready for review June 3, 2026 20:55
@sadiqkhoja sadiqkhoja force-pushed the features/web-form-setting-at-def-level branch from 25a28a5 to 8613ae3 Compare June 3, 2026 20:57
@sadiqkhoja sadiqkhoja requested a review from matthew-white June 3, 2026 21:02
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