Skip to content
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

fix(native-app): add missing error messages for updating profile information #15898

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Sep 4, 2024

I noticed translations were missing for errors when updating some profile information fails.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced error handling with clearer, localized messages for phone, email, bank info, and confirmation sections.
    • New error keys introduced for better categorization and access of error messages.
  • Bug Fixes

    • Corrected spelling in error messages for bank info and confirmation screens.
    • Improved clarity of error messages for profile updates.
  • Chores

    • Removed unnecessary console log statement in the email update process.

@thoreyjona thoreyjona requested a review from a team as a code owner September 4, 2024 21:19
Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

Walkthrough

The changes involve renaming keys in the localization files for error messages, specifically removing the .button prefix for consistency and clarity. This applies to the en.ts and is.ts files, affecting various sections such as phone, email, bank info, and confirmation. Additionally, modifications were made in the corresponding screen components to improve error messaging and user feedback, including correcting spelling errors and utilizing internationalization for dynamic message retrieval.

Changes

Files Change Summary
apps/native/app/src/messages/en.ts Renamed error-related keys by removing .button prefix for consistency.
apps/native/app/src/messages/is.ts Similar renaming of error-related keys as in en.ts, with new keys introduced for bank info and confirmation.
apps/native/app/src/screens/settings/*.tsx Updated error messages in EditBankInfoScreen and EditConfirmScreen for clarity; removed console log in EditEmailScreen.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thoreyjona thoreyjona added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 4, 2024
Copy link
Contributor

@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.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e61152a and 3026d85.

Files selected for processing (5)
  • apps/native/app/src/messages/en.ts (3 hunks)
  • apps/native/app/src/messages/is.ts (3 hunks)
  • apps/native/app/src/screens/settings/edit-bank-info.tsx (2 hunks)
  • apps/native/app/src/screens/settings/edit-confirm.tsx (1 hunks)
  • apps/native/app/src/screens/settings/edit-email.tsx (1 hunks)
Files skipped from review due to trivial changes (2)
  • apps/native/app/src/screens/settings/edit-bank-info.tsx
  • apps/native/app/src/screens/settings/edit-email.tsx
Additional context used
Path-based instructions (3)
apps/native/app/src/screens/settings/edit-confirm.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/messages/en.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/messages/is.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (11)
apps/native/app/src/screens/settings/edit-confirm.tsx (2)

56-56: LGTM!

The change from a generic error message to a more descriptive one enhances clarity about the nature of the failure.


59-62: Great work on adding i18n support!

Using intl.formatMessage with specific message IDs for the error title and message improves the user experience by providing localized feedback.

Verify that the message IDs edit.confirm.error and edit.confirm.errorMessage are defined correctly in the localization files.

Run the following script to search for the message IDs in the localization files:

Verification successful

Message IDs are correctly defined and localized

The message IDs edit.confirm.error and edit.confirm.errorMessage are properly defined in the localization files with translations available in both English and Icelandic. This confirms that the internationalization setup is correctly implemented for these messages.

  • apps/native/app/src/messages/en.ts
  • apps/native/app/src/messages/is.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the message IDs are defined in the localization files.

# Test: Search for the message IDs in TypeScript files. Expect: Matches in the localization files.
rg --type ts $'edit\.confirm\.error|edit\.confirm\.errorMessage'

Length of output: 628

apps/native/app/src/messages/en.ts (5)

493-494: LGTM!

The changes to the error message keys for the edit phone section are approved. Removing the redundant button segment improves clarity and consistency.


502-503: LGTM!

The changes to the error message keys for the edit email section are approved. Removing the redundant button segment improves clarity and consistency.


513-514: LGTM!

The changes to the error message keys for the edit bank info section are approved. Removing the redundant button segment improves clarity and consistency.


528-529: LGTM!

The changes to the error message keys for the edit confirmation section are approved. Removing the redundant button segment improves clarity and consistency.


Line range hint 1-1: Verify the usage of the renamed keys in the codebase.

Ensure that all usages of the error message keys have been updated to match the new key format without the button segment.

Run the following script to verify the key usage:

Verification successful

Verification Successful: Key Usage Updated Correctly

The error message keys have been successfully updated to the new format without the button segment. The old key format is not present in the codebase, and the new key format is used consistently across relevant files.

  • Files with updated key usage:
    • apps/native/app/src/messages/en.ts
    • apps/native/app/src/messages/is.ts
    • apps/native/app/src/screens/settings/edit-phone.tsx
    • apps/native/app/src/screens/settings/edit-bank-info.tsx
    • apps/native/app/src/screens/settings/edit-email.tsx
    • apps/native/app/src/screens/settings/edit-confirm.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of the error message keys have been updated to match the new key format.

# Test: Search for the old key format. Expect: No results.
rg --type tsx --type ts $'\'edit\.(phone|email|bankinfo|confirm)\.button\.(error|errorMessage)\''

# Test: Search for the new key format. Expect: At least one result for each key.
rg --type tsx --type ts $'\'edit\.(phone|email|bankinfo|confirm)\.(error|errorMessage)\''

Length of output: 253


Script:

#!/bin/bash
# Description: Verify all usages of the error message keys have been updated to match the new key format.

# Test: Search for the old key format. Expect: No results.
rg $'\'edit\.(phone|email|bankinfo|confirm)\.button\.(error|errorMessage)\''

# Test: Search for the new key format. Expect: At least one result for each key.
rg $'\'edit\.(phone|email|bankinfo|confirm)\.(error|errorMessage)\''

Length of output: 2463

apps/native/app/src/messages/is.ts (4)

493-494: LGTM!

The code changes are approved.


502-503: LGTM!

The code changes are approved.


513-514: LGTM!

The code changes are approved.


528-529: LGTM!

The code changes are approved.

Copy link
Contributor

@snaerseljan snaerseljan left a comment

Choose a reason for hiding this comment

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

Awesome!

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.85%. Comparing base (6bfcab3) to head (304f2ae).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15898   +/-   ##
=======================================
  Coverage   36.85%   36.85%           
=======================================
  Files        6684     6684           
  Lines      136781   136781           
  Branches    38885    38885           
=======================================
  Hits        50415    50415           
  Misses      86366    86366           
Flag Coverage Δ
web 1.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6bfcab3...304f2ae. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs fee25a8 🔗

3 Total Test Services: 0 Failed, 2 Passed
➡️ Test Sessions change in coverage: 21 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
service-portal-core 0 0 0 5 0 1.84s N/A Link
service-portal-health 0 0 0 0 0 527.6ms 1 no change Link
web 0 0 0 84 0 29.46s 1 no change Link

@kodiakhq kodiakhq bot merged commit 2c15109 into main Sep 6, 2024
43 checks passed
@kodiakhq kodiakhq bot deleted the fix/update-error-messages-edit-info branch September 6, 2024 11:58
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
…rmation (#15898)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 14, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants