-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Line fieldmapping required value #115
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes Line field mapping required value handling by implementing grouped field validation and streamlining the field mapping interface. The changes move from individual message builders to a unified grouped processing approach that validates required fields per group.
- Replaces multiple individual message builders with a unified
processGrouped
method - Implements proper field grouping by type with required field validation
- Simplifies the frontend field mapping interface by disabling manual field selection
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
includes/Actions/Line/RecordApiHelper.php | Refactors message building to use grouped field processing with required field validation |
frontend-dev/src/components/AllIntegrations/Line/LineFieldMap.jsx | Simplifies field mapping interface by removing unused parameters and disabling field selection |
frontend-dev/src/components/AllIntegrations/Line/LineCommonFunc.js | Adds field type grouping logic and improves group ID generation for field mapping |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
frontend-dev/src/components/AllIntegrations/Line/LineCommonFunc.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
frontend-dev/src/components/AllIntegrations/Line/LineCommonFunc.js
Outdated
Show resolved
Hide resolved
frontend-dev/src/components/AllIntegrations/Line/LineCommonFunc.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
$key = $field->lineFormField; | ||
|
||
if ($field->formField === 'custom' && !empty($field->customValue)) { | ||
if ($field->formField === 'custom' && (isset($field->customValue) && $field->customValue !== '')) { |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition can be simplified to !empty($field->customValue)
which handles both isset and non-empty string checks more concisely.
if ($field->formField === 'custom' && (isset($field->customValue) && $field->customValue !== '')) { | |
if ($field->formField === 'custom' && !empty($field->customValue)) { |
Copilot uses AI. Check for mistakes.
}, 300) | ||
|
||
if (val === 3 && !(lineConf?.name || isNextButtonEnabled())) { | ||
if (val === 3 && !lineConf?.name && !isNextButtonEnabled()) { |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition logic appears incorrect. It should be if (val === 3 && (!lineConf?.name || !isNextButtonEnabled()))
using OR instead of AND, since validation should fail if either the name is missing OR the button is not enabled.
if (val === 3 && !lineConf?.name && !isNextButtonEnabled()) { | |
if (val === 3 && (!lineConf?.name || !isNextButtonEnabled())) { |
Copilot uses AI. Check for mistakes.
export const handleFieldMapping = (event, index, _, setConf, type) => { | ||
export const handleFieldMapping = (event, index, setConf, type) => { | ||
setConf(prev => | ||
updateFieldMap(prev, type, index, () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store the anonymous function in a variable first, then pass that variable as a parameter.
$messages[] = $text; | ||
} | ||
|
||
if (!empty($details->sendSticker) && !empty($details->sticker_field_map)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use isset instead of !empty
$messages = array_merge($messages, $stickers); | ||
} | ||
|
||
if (!empty($details->sendImage) && !empty($details->image_field_map)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
$messages = array_merge($messages, $images); | ||
} | ||
|
||
if (!empty($details->sendAudio) && !empty($details->audio_field_map)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
} | ||
} | ||
|
||
if (!empty($details->sendVideo) && !empty($details->video_field_map)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace all !empty checks with isset
No description provided.