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

Feature/actors conditions #19139

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ccailly
Copy link
Member

@ccailly ccailly commented Mar 6, 2025

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.

Description

image

@ccailly ccailly force-pushed the feature/actors-conditions branch from c9c1be8 to 6657833 Compare March 6, 2025 09:03
@ccailly ccailly requested a review from Copilot March 6, 2025 12:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR enhances the form handling functionality by adding support for array values in form answers and incorporating extra question data into the editor state. Key changes include:

  • Updating the condition engine to support array values.
  • Adding a utility to extract extra question data in the editor controller.
  • Updating documentation of form questions to include extra_data.

Reviewed Changes

File Description
js/modules/Forms/Condition/Engine.js Added support for handling array answers and refined key checking logic.
js/modules/Forms/EditorController.js Introduced #getQuestionExtraData to capture additional question input data.
js/modules/Forms/ConditionEditorController.js Updated JSDoc type for extra_data in form questions.

Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

js/modules/Forms/Condition/Engine.js:82

  • Changing the condition to check for keys that strictly start with 'answers_' may inadvertently skip valid keys if 'answers_' appears later in the string. Consider verifying whether this change is intentional or if a different condition should be applied.
if (key.indexOf('answers_') !== 0) {

@ccailly ccailly force-pushed the feature/actors-conditions branch from 6657833 to 67c2862 Compare March 6, 2025 13:13
@ccailly ccailly marked this pull request as ready for review March 6, 2025 13:13
@ccailly ccailly self-assigned this Mar 6, 2025
@ccailly ccailly added the Forms label Mar 6, 2025
@ccailly ccailly added this to the 11.0.0 milestone Mar 6, 2025
Comment on lines +107 to +108
{# Get condition handler's input template #}
{{ manager.getInputTemplateForCondition(condition, "_conditions[" ~ loop.index0 ~ "][value]")|raw }}
Copy link
Contributor

@AdrienClairembault AdrienClairembault Mar 6, 2025

Choose a reason for hiding this comment

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

We want to avoid inline twig as it is not linted.
I would prefer an elseif case here keeping the original behavior OR to use dedicated twig files for each types (in this case getInputTemplateForCondition would return the file name instead of an enum key).

For the specific parameters, you can probably add a second getInputTemplateParametersForCondition method, for which its results would be passed to the template ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants