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

Test ai comments #2639

Closed
wants to merge 10 commits into from
Closed

Test ai comments #2639

wants to merge 10 commits into from

Conversation

mdshamoon
Copy link
Member

Summary

Test ai comments

@mdshamoon mdshamoon added the review ai bot review label Nov 26, 2023
pull_request:
types:
- labeled
permissions: write-all

Choose a reason for hiding this comment

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

It's recommended to secure the permissions setting. Using write-all could pose a security risk. Specify more granular permissions based on the exact needs of the GitHub action.

@@ -152,6 +152,9 @@ export const GUPSHUP_QUICK_REPLY =
export const CALL_TO_ACTION = 'CALL_TO_ACTION';
export const LIST = 'LIST';
export const QUICK_REPLY = 'QUICK_REPLY';
export const LOCATION_REQUEST = 'LOCATION_REQUEST_MESSAGE';

Choose a reason for hiding this comment

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

New constants have been added here; ensure that these changes are reflected anywhere in the codebase that could utilize these new constants, including tests and any relevant documentation.

@@ -209,10 +212,3 @@ export const yupPasswordValidation = (t: any) =>
)
.min(10, t('Password must be at least 10 characters long.'))

Choose a reason for hiding this comment

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

The removal of the constants INTERACTIVE_QUICK_REPLY and INTERACTIVE_LIST may impact existing code that depends on them. Ensure to update all references and any possible import conflicts throughout the codebase.

@@ -134,6 +134,8 @@ export const getInteractiveMessageBody = (interactiveJSON: any) => {
default:
break;
}
} else if (interactiveJSON.type === 'location_request_message') {

Choose a reason for hiding this comment

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

When checking the type of interactiveJSON for location_request_message, ensure that it is consistently named and matches the pattern and naming conventions used for other message types, including the JSON structure being parsed elsewhere.

INTERACTIVE_LIST,
INTERACTIVE_QUICK_REPLY,
LIST,
QUICK_REPLY,

Choose a reason for hiding this comment

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

The change from INTERACTIVE_LIST and INTERACTIVE_QUICK_REPLY to LIST and QUICK_REPLY needs to be reflected in the entire codebase. Watch out for any discrepancies that might occur due to this refactor.

@@ -477,7 +507,7 @@
},
// checkbox is not needed in media types
{
skip: type && type.label,
skip: (type && type.label) || isLocationRequestType,

Choose a reason for hiding this comment

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

Adding isLocationRequestType to handle conditionally rendering certain form fields. Ensure that all required form fields relevant to location request templates are rendered and functional.

@@ -602,6 +625,24 @@
interactiveContent: JSON.stringify(listJSON),
});
}

if (templateType === LOCATION_REQUEST) {

Choose a reason for hiding this comment

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

Implementing location request handling here requires thorough validation to ensure that the information is formatted correctly and communicated to the server appropriately.

@@ -631,6 +672,7 @@
if (translations) {
translationsCopy = JSON.parse(translations);
translationsCopy[language.id] = JSON.parse(payloadData.interactiveContent);
setTranslations(JSON.stringify(translationsCopy));

Choose a reason for hiding this comment

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

Setting translations in state needs a cautious approach. Confirm that translations are being applied correctly, and there are no race conditions or stale state.

@@ -702,7 +744,9 @@
},
];

let formFields: any = templateType === LIST ? [...fields] : [...fields, ...attachmentInputs];
let formFields: any =
templateType === QUICK_REPLY ? [...fields, ...attachmentInputs] : [...fields];

Choose a reason for hiding this comment

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

The condition for rendering formFields has been modified. Verify that this change doesn't exclude necessary fields for types such as LOCATION_REQUEST.

LIST: 'List',
};

return <p className={styles.TableText}>{typeMappings[text]}</p>;

Choose a reason for hiding this comment

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

Ensure that the new mapping for the typeMappings object is accurately used throughout the UI, and matches the expected values for message types.

@glific glific deleted a comment from github-actions bot Nov 26, 2023
@glific glific deleted a comment from github-actions bot Nov 26, 2023
@mdshamoon mdshamoon added review ai bot review and removed review ai bot review labels Nov 26, 2023
@@ -0,0 +1,48 @@
import { Button } from '@mui/material';
import LocationIconDark from 'assets/images/icons/Location/Dark.svg?react';

Choose a reason for hiding this comment

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

Avoid hard coding string 'location' as it might be used at other places as well. It will be easier to manage if you set it as a constant variable.

<ChatMessageType type="TEXT" body={body} isSimulatedMessage={isSimulator} />
</div>
<Button
variant="text"

Choose a reason for hiding this comment

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

Check if onSendLocationClick is not null or undefined before calling it. This will prevent potential errors in case the function is not provided

font-family: 'Heebo', sans-serif, emoji;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
clear: both;
max-width: 404px;

Choose a reason for hiding this comment

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

The max-width attribute has been declared twice. Consider removing one of them.

font-family: 'Heebo', sans-serif, emoji;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
clear: both;
max-width: 404px;

Choose a reason for hiding this comment

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

You have defined 'max-width' twice here. Please remove the duplicate.

@mdshamoon mdshamoon closed this Nov 26, 2023
@AkhileshNegi AkhileshNegi deleted the test/ai-comments branch December 6, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review ai bot review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant