-
Notifications
You must be signed in to change notification settings - Fork 13.1k
[IMPROVE] Capability to search visitors by custom fields #26178
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
Conversation
…o new/custom-field-search
KevLehman
left a comment
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.
There's also some "custom fields" specially made for livechat that i don't see here 👀 (endpoints) could you pls check that? Thanks!
| const allowedCF = LivechatCustomField.find({ scope: 'visitor' }, { fields: { _id: 1 } }, { searchability: true }).map( | ||
| ({ _id }) => _id, | ||
| ); | ||
| const customObj = Object.fromEntries(Array.from(new URLSearchParams(custom)).filter(([k]) => allowedCF.includes(k))); |
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.
Can you share an example of what custom would look like? Wanna see why we need to manually parsing the searchparams 👀
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.
sure, we can make one with new URLSearchParams({field:1,other:"string"}).toString(), for example, that leads to field=1&other=string, and the quoted line way to get the object to put on the query.
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.
No but, how will that key look like? 👀 cause from what you have seems custom will be something like custom=a=1&b=1 which I'm not sure how url safe would be 🤔
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.
it gets URL encoded, so it's end up as custom=a%3D1%26b%3D1, very ugly but works.
|
|
||
| return preserveHtml ? html : html && sanitizer(html, { ADD_ATTR: ['target'] }); | ||
| }, [content, preserveHtml, sanitizer, markedOptions, parseEmoji]); | ||
| }, [content, preserveHtml, sanitizer, markedOptions, parseEmoji, variant]); |
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.
🤔
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.
typescript complained that it was being used without being depended on
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.
Weird, if it's not affecting the pipeline, leave this one out of the PR and notify alek/tiago so they can look at it. (I haven't got this issue, so could have been removed intentional 👀 )
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.
it does affect the CI, breaking on eslintreact-hooks/exhaustive-deps
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.
No but, can you try updating with latest of develop? I'm curious why this is not failing on any other place 👀
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.
done
…at/Rocket.Chat into new/custom-field-search
Co-authored-by: Kevin Aleman <kaleman960@gmail.com>
…/Rocket.Chat into new/custom-field-search
…o new/custom-field-search
…/Rocket.Chat into new/custom-field-search
Proposed changes (including videos or screenshots)
Users of the endpoints api/v1/omnichannel/contact.search and /api/v1/livechat/visitors.search are now able to search by custom fields in their objects.
Capability of selecting if a custom field can be searched for is added in the Omnichannel pannel as a toggle for
searchable, the included JSON in the Accounts' Custom Field example has been updated to make it explicit for future configurations that the field has to be enabled as searchable for that to happen.Issue(s)
Steps to test or reproduce
Create a new custom field on Omnichannel->custom field, selecting it as searchable.
Edit a LiveChat visitor conversation to include custom field created above.
On the contact center, you can now search for the contents of that custom field.
Further comments
This branch is broken, here is the new one