-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FIX] Unset Visitor Phone on Empty String for Test Widget #1142
Changes from 4 commits
4c9ff0b
c59fd77
081b124
c54835d
1cbc15f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,11 +307,15 @@ export const Livechat = { | |
const updateUser = { | ||
$set: { | ||
token, | ||
...(phone?.number ? { phone: [{ phoneNumber: phone.number }] } : {}), | ||
...(phone?.number && phone.number !== 'delete' ? { phone: [{ phoneNumber: phone.number }] } : {}), | ||
...(name ? { name } : {}), | ||
}, | ||
}; | ||
|
||
if (phone === undefined) { | ||
updateUser.$unset = { phone: [] }; | ||
} | ||
|
||
Comment on lines
+315
to
+318
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlexanderKanakis @ear-dev I'm still seeing the same behavior. In the DB, the phone number is not stored. When I uncommented this code. It is being stored in the DB. And it needs to be stored in DB. Because... For Twilio integration, we use this phone number to send messages. @AlexanderKanakis I think the reason for this issue is because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps then using 'delete', the way @AlexanderKanakis originally designed it is the best solution? It is surely only in our test widget that 'delete' would be set for phone number. @Shailesh351 is that our best design do you think? |
||
if (email) { | ||
email = email.trim(); | ||
validateEmail(email); | ||
|
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.
you're still looking for 'delete' here? didn't you change this to 'null'? so should this be phone.number !== undefined? Or, do you even need this condition here?