-
Notifications
You must be signed in to change notification settings - Fork 32
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
Automatically transform phone numbers to international standard #2791
Conversation
(Sorry, I mis-clicked when filtering for issues, it's not Q3 yet... 🤦🏼♀️ By the time I realized it was already done.) |
Code Climate has analyzed commit 07e12c9 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 81.7% (-0.5% change). View more on Code Climate. |
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.
Nice 😸
(Sorry, I mis-clicked when filtering for issues, it's not Q3 yet... 🤦🏼♀️ By the time I realized it was already done.)
🙈 Anyway it's an improvement 😉
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.
Thank you very much for this PR. It looks very good already!
While testing this, I noticed that telephone numbers such as 0123 456789 or 0123-456789 aren't caught by this PR (yet). (I found in our test system that municipalities use both cases and even a combination 0123 4567-89 😅). Do you think it's possible to include them too or would that be too difficult/too fuzzy given the empty space/dash between?
Secondly, although this is Javascript code I thought that we might still include a (pytest) test for this? My test idea would be to do a POST request to the page form entering a telephone number in a wrong format and then checking in a database request that the format is right in the database. Do you think that would work reliably and test what it should be testing? 🤔
integreat_cms/static/src/js/tinymce-plugins/autolink_tel/plugin.js
Outdated
Show resolved
Hide resolved
abfef71
to
4c437b6
Compare
Yeah, I think this is a good idea. An OK compromise would maybe be to match all strings that
right? Only trouble is it would for example also match Edit: Oh, I just realized that this would also prematurely add a link after, for example,
Not so easy, unfortunately. AFAIK this would not trigger the rewrite, since it doesn't happen when POSTing to the backend, only when pressing space/enter after entering such a number. |
Okay, I think that's fine. We just need to communicate it to the service-team, so they can think about how to communicate to the municipalities.
Depending on the effort I think that would be good, as some municipalities seem to use the 0123-456789
Ok. I think I get it now. Thank you for explaining :) |
ad43fd1
to
5cf8616
Compare
@JoeyStk dash is now included. It would also be an option to only allow dashes after a certain amount of numbers (e.g. if we assume all phone numbers start with either a country code +xx, 00xx, or a "Vorwahl" 0xxxx), but not sure if that wouldn't be too strict or could potentially miss some weird ways to write the numbers. |
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.
Thank you so much for the change. I double-checked with @vthejay and the most important cases are now being handled. Apparently it's no problem that space is not supported as they discourage municipalities to do use this format in the workshops already.
I found one small last thing: When I type 0123/456789 and hit enter I get "+49 (0) 123/456789" back. @vthejay and I agreed that this isn't ideal as the "/" should not show in the final string anymore :) Do you think it's possible to remove it? :)
5cf8616
to
07e12c9
Compare
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.
🚀
Short description
Automatically transform phone numbers to international standard.
Proposed changes
+<country code>
Side effects
Resolved issues
Fixes: #908
Pull Request Review Guidelines