feat(#10846): add local_phone mustache helper to strip country code in SMS#10868
feat(#10846): add local_phone mustache helper to strip country code in SMS#10868megha1807 wants to merge 5 commits intomedic:masterfrom
Conversation
|
@binokaryg All 8 integration test failures are pre-existing flaky tests unrelated to this PR:
None of these touch |
|
Thanks @megha1807, I will review this. I will retry the failing tests a few more times if needed. Meanwhile, please make sure that you have gone through our AI guidelines for contributors. |
|
Thanks @binokaryg! AI Disclosure: I used Claude to understand the codebase structure and explore possible approaches for implementing the Mustache helper. The final implementation, testing, and refinements were done by me, and I verified the behavior with SMS workflows to ensure correctness and backward compatibility. Please let me know if any changes are needed. |
Could you please add it to the PR description? |
|
Thanks @binokaryg, I’ve added the AI disclosure to the PR description. |
There was a problem hiding this comment.
Hi @megha1807, I think the implementation is good.
Could you please add the following scenarios to the tests?
default_country_codeset as a numeric
e.g.- phone number that is already in local format e.g.
9841234567
Also a documentation for usage (separate PR on medic/cht-docs) would be helpful for users to discover and use this helper. Would you be able to do it?
|
Hi @binokaryg, thank you for reviewing this and for the helpful suggestions. I’ll add the requested test scenarios for numeric "default_country_code" and numbers already in local format. I’ll also prepare a separate documentation PR in "medic/cht-docs" explaining the usage of this helper so it’s easier for users to discover and implement. Thanks again - I’ll work on these updates shortly. |
|
@binokaryg I've added both test cases:
Also updated I'll prepare the |
Description
Adds a new
local_phoneMustache template helper tomessage-utilsthat strips the country code prefix from phone numbers in outgoing SMS messages.This allows SMS message authors to render phone numbers in local format without modifying stored contact data.
Closes #10846
Usage example
Before:
+9779841234567After:
9841234567Template syntax:
Contact {{#local_phone}}{{facility_phone}}{{/local_phone}} for help.
The helper reads
default_country_codefromapp_settings. If the phone number starts with+{country_code}, the prefix is stripped. Otherwise the number is returned unchanged. Existing templates without this helper are completely unaffected.AI Disclosure: I used Claude to understand the codebase structure and explore possible approaches for implementing the Mustache helper. The final implementation, testing, and refinements were done by me, and I verified the behavior with SMS workflows to ensure correctness and backward compatibility.
Code review checklist