[messages] allow * and # in phone number#328
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
WalkthroughA single-line modification in MessagesService.kt updates the phone number normalization filter to include asterisk ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt (1)
426-429: LGTM — allows USSD-style phone numbers when validation is skipped.The change correctly extends the permissive filter to include
*and#characters, which are standard in USSD codes (e.g.,*123#) and dial strings. Since this only applies whenskipPhoneValidation=true, the strict E.164 validation viaPhoneHelperremains the default behavior.Minor readability suggestion: consider extracting the allowed characters into a constant or using a set for clarity, though this is optional.
♻️ Optional refactor for readability
+private val ALLOWED_PHONE_CHARS = setOf('+', '*', '#') + val normalizedPhoneNumber = when (request.params.skipPhoneValidation) { - true -> phoneNumber.filter { it.isDigit() || it == '+' || it == '*' || it == '#' } + true -> phoneNumber.filter { it.isDigit() || it in ALLOWED_PHONE_CHARS } false -> PhoneHelper.filterPhoneNumber(phoneNumber, countryCode ?: "RU") }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt` around lines 426 - 429, Extract the allowed characters used in the permissive branch into a named constant (e.g., ALLOWED_USSD_CHARS or a Set like USSD_ALLOWED_CHAR_SET) and replace the inline predicate in the normalizedPhoneNumber assignment (the branch guarded by request.params.skipPhoneValidation) with a clear membership check against that constant/set; keep the PhoneHelper.filterPhoneNumber(countryCode ?: "RU") call unchanged for the strict branch and reference the symbols normalizedPhoneNumber, request.params.skipPhoneValidation, and PhoneHelper.filterPhoneNumber when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt`:
- Around line 426-429: Extract the allowed characters used in the permissive
branch into a named constant (e.g., ALLOWED_USSD_CHARS or a Set like
USSD_ALLOWED_CHAR_SET) and replace the inline predicate in the
normalizedPhoneNumber assignment (the branch guarded by
request.params.skipPhoneValidation) with a clear membership check against that
constant/set; keep the PhoneHelper.filterPhoneNumber(countryCode ?: "RU") call
unchanged for the strict branch and reference the symbols normalizedPhoneNumber,
request.params.skipPhoneValidation, and PhoneHelper.filterPhoneNumber when
making the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4358e53a-fd97-4eed-a501-70c2581e1c6f
📒 Files selected for processing (1)
app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt
🤖 Pull request artifacts
|
Summary by CodeRabbit
Release Notes