Skip to content

WEB-638 fix: improve core utility logic and migrate from deprecated … - #3062

Merged
IOhacker merged 1 commit into
openMF:devfrom
shubhamkumar9199:fix/bitwise-or-and-deprecated-substr
Jan 31, 2026
Merged

WEB-638 fix: improve core utility logic and migrate from deprecated …#3062
IOhacker merged 1 commit into
openMF:devfrom
shubhamkumar9199:fix/bitwise-or-and-deprecated-substr

Conversation

@shubhamkumar9199

@shubhamkumar9199 shubhamkumar9199 commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

…substr

This PR addresses several underlying logic errors and technical debt in the core utility functions and system components to improve application stability and security.

WEB-638

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • Bug Fixes
    • Improved date parsing/formatting for more accurate handling of specified date formats
    • Fixed password validation to correctly respect configured minimum length in change flows
    • Adjusted masking for sensitive keys in S3 and notification integrations to better protect credentials
    • Minor string-handling fixes affecting column type parsing and sorting behavior

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 31, 2026

Copy link
Copy Markdown

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Replaces several uses of String.substr with String.substring, fixes bitwise OR defaults to logical OR for password length, adjusts date parsing/formatting to use moment with explicit format token mappings, and refines masking substring ranges in external-service components.

Changes

Cohort / File(s) Summary
String method modernization (substr → substring)
src/app/core/utils/commons.ts, src/app/system/manage-data-tables/column-dialog/column-dialog.component.ts, src/app/system/manage-data-tables/edit-data-table/edit-data-table.component.ts
Replaces substr() with substring() for extracting substrings; behavior preserved for typical inputs.
Bitwise → logical OR for password defaults
src/app/core/utils/passwords-utility.ts, src/app/shared/change-password-dialog/change-password-dialog.component.ts
Replaces bitwise OR (`
Date format/parse adjustments
src/app/core/utils/dates.ts
Transforms incoming format tokens (y→Y, d→D, a→A) and uses moment(value, adjustedFormat) for parsing and moment(date).format(adjustedFormat) for formatting.
External service masking range tweak
src/app/system/external-services/amazon-s3/amazon-s3.component.ts, src/app/system/external-services/notification/notification.component.ts
Switches masking from substr to substring and adjusts the masked range endpoints (now using substring(1, value.length - 2)), changing which middle characters are replaced with *.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • gkbishnoi07
  • IOhacker
🚥 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 accurately reflects the main changes: fixing core utility logic and migrating from deprecated substr method across multiple utility files.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/app/core/utils/dates.ts`:
- Around line 47-48: The convertToDate method currently passes Angular
DatePipe-style formats (e.g., SettingsService.businessDateFormat = 'yyyy-MM-dd')
directly to Moment, which uses different tokens; update convertToDate to first
normalize common Angular DatePipe tokens to Moment equivalents (e.g., yyyy→YYYY,
MM→MM, dd→DD), then call moment(value, normalizedFormat, true) to enable strict
parsing, and if strict parsing fails fall back to a safe alternative (e.g., try
ISO parsing via Date or a non-format moment parse) before returning a Date;
reference convertToDate and SettingsService.businessDateFormat when locating
where to add the normalization, strict flag, and fallback logic.

Comment thread src/app/core/utils/dates.ts Outdated
@shubhamkumar9199
shubhamkumar9199 force-pushed the fix/bitwise-or-and-deprecated-substr branch from 5c0122c to 6bcf417 Compare January 31, 2026 10:22

@IOhacker IOhacker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@IOhacker
IOhacker merged commit 41a71cd into openMF:dev Jan 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants