Skip to content

Conversation

Md-Abed-Hossen
Copy link
Contributor

No description provided.

@RishadAlam RishadAlam requested a review from Copilot September 8, 2025 09:15
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.

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.

@RishadAlam RishadAlam requested a review from Copilot September 13, 2025 06:33
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.

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.

@RishadAlam RishadAlam requested a review from Copilot October 7, 2025 06:23
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.

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 !== '')) {
Copy link

Copilot AI Oct 7, 2025

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.

Suggested change
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()) {
Copy link

Copilot AI Oct 7, 2025

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.

Suggested change
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, () => ({
Copy link
Member

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)) {
Copy link
Member

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)) {
Copy link
Member

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)) {
Copy link
Member

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)) {
Copy link
Member

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

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