Skip to content

[messages] allow * and # in phone number#328

Merged
capcom6 merged 1 commit intomasterfrom
issue/327-phone-number-filtering
Mar 13, 2026
Merged

[messages] allow * and # in phone number#328
capcom6 merged 1 commit intomasterfrom
issue/327-phone-number-filtering

Conversation

@capcom6
Copy link
Copy Markdown
Owner

@capcom6 capcom6 commented Mar 11, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced phone number handling when validation is disabled to preserve asterisks and hash symbols alongside digits and the plus sign.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@capcom6 capcom6 linked an issue Mar 11, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 11, 2026

Walkthrough

A single-line modification in MessagesService.kt updates the phone number normalization filter to include asterisk (*) and hash (#) characters alongside digits and plus signs when phone validation is skipped.

Changes

Cohort / File(s) Summary
Phone Number Normalization
app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt
Updated character filter to allow * and # in addition to digits and + when skipPhoneValidation is true.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: allowing * and # characters in phone numbers when validation is skipped, which matches the file modification in MessagesService.kt.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue/327-phone-number-filtering

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 when skipPhoneValidation=true, the strict E.164 validation via PhoneHelper remains 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

📥 Commits

Reviewing files that changed from the base of the PR and between e549ecd and 6b7263d.

📒 Files selected for processing (1)
  • app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Pull request artifacts

file commit
app-release.apk 6b7263d
app-release.aab 6b7263d
app-insecure.apk 6b7263d
app-insecure.aab 6b7263d

@capcom6 capcom6 added the ready label Mar 12, 2026
@capcom6 capcom6 merged commit 1251ae5 into master Mar 13, 2026
3 checks passed
@capcom6 capcom6 deleted the issue/327-phone-number-filtering branch March 13, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skipPhoneValidation strips * and # characters from phone numbers

1 participant