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

[Due for payment 2025-02-25] [$250] Wrong system message when updating role in Spanish #55781

Open
1 of 8 tasks
m-natarajan opened this issue Jan 27, 2025 · 33 comments
Open
1 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Overdue

Comments

@m-natarajan
Copy link

m-natarajan commented Jan 27, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.89-5
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation (hyperlinked to channel name): expensify_bugs

Action Performed:

  1. Invite a new user to a workspace
  2. Update role of this user to admin
  3. Update role of this user to auditor
  4. Go to #admin room

Expected Result:

System message of update role show correct

Actual Result:

System message of update role shows wrong

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
bug-resize.mp4

Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021884096456183632431
  • Upwork Job ID: 1884096456183632431
  • Last Price Increase: 2025-01-28
  • Automatic offers:
    • shubham1206agra | Contributor | 105909090
Issue OwnerCurrent Issue Owner: @MitchExpensify
@m-natarajan m-natarajan added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 27, 2025
Copy link

melvin-bot bot commented Jan 27, 2025

Triggered auto assignment to @MitchExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@m-natarajan
Copy link
Author

Propopsal from @shubham1206agra

Proposal

Please re-state the problem that we are trying to solve in this issue.

Wrong system message when updating role in Spanish

What is the root cause of that problem?

In

App/src/languages/es.ts

Lines 4970 to 4975 in b59f23b

addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role === 'miembro' || role === 'user' ? 'miembro' : 'administrador'}`,
updateRole: ({email, currentRole, newRole}: UpdateRoleParams) =>
`actualicé el rol ${email} de ${currentRole === 'miembro' || currentRole === 'user' ? 'miembro' : 'administrador'} a ${
newRole === 'miembro' || newRole === 'user' ? 'miembro' : 'administrador'
}`,
removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'miembro' || role === 'user' ? 'miembro' : 'administrador'} ${email}`,

We do not cover the case of auditor role of the workspace user. That causes the wrong translation to occur.

What changes do you think we should make in order to solve the problem?

Let's simplify these translations

Change

App/src/languages/es.ts

Lines 4970 to 4975 in b59f23b

addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role === 'miembro' || role === 'user' ? 'miembro' : 'administrador'}`,
updateRole: ({email, currentRole, newRole}: UpdateRoleParams) =>
`actualicé el rol ${email} de ${currentRole === 'miembro' || currentRole === 'user' ? 'miembro' : 'administrador'} a ${
newRole === 'miembro' || newRole === 'user' ? 'miembro' : 'administrador'
}`,
removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'miembro' || role === 'user' ? 'miembro' : 'administrador'} ${email}`,

to

addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role}`,
updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `actualicé el rol ${email} de ${currentRole} a ${newRole}`,
removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role} ${email}`,

Now, let's update the reference of these (utilizing translation of workspace.common.roleName)

Change

const newRole = originalMessage?.newValue ?? '';
const oldRole = originalMessage?.oldValue ?? '';
return translateLocal('report.actions.type.updateRole', {email, newRole, currentRole: oldRole});

to

const newRole = translateLocal('workspace.common.roleName', {role: originalMessage?.newValue ?? ''}).toLowerCase(); 
const oldRole = translateLocal('workspace.common.roleName', {role: originalMessage?.oldValue ?? ''}).toLowerCase(); 
return translateLocal('report.actions.type.updateRole', {email, newRole, currentRole: oldRole}); 

Change

const role = originalMessage?.role ?? '';
const formattedEmail = formatPhoneNumber(email);
return translateLocal('report.actions.type.addEmployee', {email: formattedEmail, role});

to

const role = translateLocal('workspace.common.roleName', {role: originalMessage?.role ?? ''}).toLowerCase();
const formattedEmail = formatPhoneNumber(email);
return translateLocal('report.actions.type.addEmployee', {email: formattedEmail, role});

And change

const role = originalMessage?.role ?? '';
return translateLocal('report.actions.type.removeMember', {email, role});

to

const role = translateLocal('workspace.common.roleName', {role: originalMessage?.role ?? ''}).toLowerCase();
return translateLocal('report.actions.type.removeMember', {email, role});

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA since this is a simple translation change

What alternative solutions did you explore? (Optional)

@daledah
Copy link
Contributor

daledah commented Jan 27, 2025

Proposal

Please re-state the problem that we are trying to solve in this issue.

Wrong system message when updating role in Spanish

What is the root cause of that problem?

App/src/languages/es.ts

Lines 4971 to 4974 in b59f23b

updateRole: ({email, currentRole, newRole}: UpdateRoleParams) =>
`actualicé el rol ${email} de ${currentRole === 'miembro' || currentRole === 'user' ? 'miembro' : 'administrador'} a ${
newRole === 'miembro' || newRole === 'user' ? 'miembro' : 'administrador'
}`,

In the condition above we are using 'auditor' instead of 'user' because the role can only be user, auditor, admin

What changes do you think we should make in order to solve the problem?

We should update all 'miembro' in the condition to 'auditor'

App/src/languages/es.ts

Lines 4971 to 4974 in b59f23b

updateRole: ({email, currentRole, newRole}: UpdateRoleParams) =>
`actualicé el rol ${email} de ${currentRole === 'miembro' || currentRole === 'user' ? 'miembro' : 'administrador'} a ${
newRole === 'miembro' || newRole === 'user' ? 'miembro' : 'administrador'
}`,

We should do the same way with addEmployee, removeMember

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@MitchExpensify MitchExpensify added the External Added to denote the issue can be worked on by a contributor label Jan 28, 2025
@melvin-bot melvin-bot bot changed the title Wrong system message when updating role in Spanish [$250] Wrong system message when updating role in Spanish Jan 28, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021884096456183632431

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 28, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External)

@MitchExpensify MitchExpensify moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Jan 28, 2025
@dangrous dangrous self-assigned this Jan 28, 2025
@dangrous
Copy link
Contributor

I can take a look at this once it's ready for an internal engineer!

@rojiphil
Copy link
Contributor

Will pick this up for proposal review today

@rojiphil
Copy link
Contributor

Thanks for the proposals

@daledah Replacing 'miembro' with 'auditor' may work but it is better to do a clean up as suggested in @shubham1206agra proposal.

@shubham1206agra I like the idea of simplifying the translations using the translation of workspace.common.roleName. Also, note that workspace.common.roleName would return member instead of the currently used user. We would have to confirm if this change is fine.
Otherwise @shubham1206agra proposal LGTM.
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 29, 2025

Current assignee @dangrous is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@shubham1206agra
Copy link
Contributor

Thanks for the proposals

@daledah Replacing 'miembro' with 'auditor' may work but it is better to do a clean up as suggested in @shubham1206agra proposal.

@shubham1206agra I like the idea of simplifying the translations using the translation of workspace.common.roleName. Also, note that workspace.common.roleName would return member instead of the currently used user. We would have to confirm if this change is fine. Otherwise @shubham1206agra proposal LGTM. 🎀👀🎀 C+ reviewed

@rojiphil We can modify this if we found some edge case in the PR itself.

Copy link

melvin-bot bot commented Jan 29, 2025

Current assignee @dangrous is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@dangrous
Copy link
Contributor

Hi! This looks good, I think member instead of user is fine but I can double check internally.

However, can we be sure to add some unit tests for the new behavior (translated) of getPolicyChangeLogChangeRoleMessage and the other utils we're changing? Thanks!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 29, 2025
Copy link

melvin-bot bot commented Jan 29, 2025

📣 @shubham1206agra 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@dangrous
Copy link
Contributor

yep "member" is expected!

@dangrous
Copy link
Contributor

Hi again! I think we might want to hold our PR on #55596, which will change that logic slightly. Should be essentially the same solution, though.

@dangrous dangrous changed the title [$250] Wrong system message when updating role in Spanish [HOLD #55436][$250] Wrong system message when updating role in Spanish Jan 31, 2025
@dangrous
Copy link
Contributor

Updated title to hold on that other issue.

Copy link

melvin-bot bot commented Feb 4, 2025

@rojiphil, @dangrous, @MitchExpensify, @shubham1206agra Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Feb 10, 2025

@rojiphil @dangrous @MitchExpensify @shubham1206agra this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Feb 10, 2025
@MitchExpensify
Copy link
Contributor

@shubham1206agra When do you expect the PR to be ready for review?

@shubham1206agra
Copy link
Contributor

@MitchExpensify I will ready the PR today

Copy link

melvin-bot bot commented Feb 11, 2025

@rojiphil, @dangrous, @MitchExpensify, @shubham1206agra Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Feb 13, 2025

@rojiphil, @dangrous, @MitchExpensify, @shubham1206agra Still overdue 6 days?! Let's take care of this!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Overdue Weekly KSv2 labels Feb 13, 2025
@melvin-bot melvin-bot bot changed the title [$250] Wrong system message when updating role in Spanish [Due for payment 2025-02-25] [$250] Wrong system message when updating role in Spanish Feb 18, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 18, 2025
Copy link

melvin-bot bot commented Feb 18, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Feb 18, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.99-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-02-25. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 18, 2025

@rojiphil / @shubham1206agra @MitchExpensify @rojiphil / @shubham1206agra The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@MitchExpensify
Copy link
Contributor

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment:

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion:

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Precondition:

Test:

Do we agree 👍 or 👎

@MitchExpensify
Copy link
Contributor

Payment summary:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Feb 24, 2025
@MitchExpensify
Copy link
Contributor

@rojiphil bump on the BZ steps above

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 25, 2025
@rojiphil
Copy link
Contributor

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment:

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: Not Required. The existing checklist is good enough to capture such issues.

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

Precondition:

Test:

  1. Navigate to Workspace settings and, then, to Members
  2. Select a member and update the role to admin.
  3. Navigate to #admins room and verify that the translations are correct for English and Spanish.
  4. Repeat the steps from 1 to 3 and update the role to auditor
  5. Navigate to #admins room and verify that the translations are correct for English and Spanish.

Do we agree 👍 or 👎

@rojiphil
Copy link
Contributor

@MitchExpensify BZ Checklist done. Thanks.

Copy link

melvin-bot bot commented Feb 28, 2025

@MitchExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Overdue
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

6 participants