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

[HOLD for payment 2024-10-17] [$250] Plural Remove Members on the workspace members page even when we only have one member selected #49961

Closed
1 of 6 tasks
m-natarajan opened this issue Sep 30, 2024 · 26 comments
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

Comments

@m-natarajan
Copy link

m-natarajan commented Sep 30, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.41-6
Reproducible in staging?: Y
Reproducible in production?: Y
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: @allgandalf
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1727729303045069

Action Performed:

  1. Go to staging.new.expensify.com
  2. Select any workspace from settings which have members
  3. Click Members > select any added member
  4. Click the dropdown in the 1 selected pill

Expected Result:

Remove member displayed as only one member selected

Actual Result:

Remove members displayed even if only one member selected

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Screenshot 2024-10-01 at 2 17 22 AM

Snip - (53) New Expensify - Google Chrome

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021841413637223772836
  • Upwork Job ID: 1841413637223772836
  • Last Price Increase: 2024-10-02
  • Automatic offers:
    • allgandalf | Reviewer | 104321898
    • nkdengineer | Contributor | 104321900
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @trjExpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 30, 2024
Copy link

melvin-bot bot commented Sep 30, 2024

Triggered auto assignment to @trjExpensify (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.

Copy link
Contributor

adrian-brc Your proposal will be dismissed because you did not follow the proposal template.

@Krishna2323
Copy link
Contributor

Krishna2323 commented Sep 30, 2024

Edited by proposal-police: This proposal was edited at 2024-09-30 23:16:29 UTC.

Proposal

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

Plural Remove Members on the workspace members page even when we only have one member selected

What is the root cause of that problem?

We are using always using workspace.people.removeMembersTitle.

text: translate('workspace.people.removeMembersTitle'),

title={translate('workspace.people.removeMembersTitle')}

text: translate('workspace.people.removeMembersTitle'),

title={translate('workspace.people.removeMembersTitle')}

text: translate('workspace.people.removeMembersTitle'),

title={translate('workspace.people.removeMembersTitle')}

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

  • We should check selectedEmployees.length and use workspace.people.removeMemberTitle if it is 1 otherwise workspace.people.removeMembersTitle.

  • The same need to be done in ReportParticipantsPage & RoomMembersPage. In these components we need to use selectedMembers.length

  • We also need to update confirmModalPrompt.

    const confirmModalPrompt = useMemo(() => {
    const approverAccountID = selectedEmployees.find((selectedEmployee) => Member.isApprover(policy, selectedEmployee));
    if (!approverAccountID) {
    return translate('workspace.people.removeMembersPrompt');
    }
    return translate('workspace.people.removeMembersWarningPrompt', {
    memberName: getDisplayNameForParticipant(approverAccountID),
    ownerName: getDisplayNameForParticipant(policy?.ownerAccountID),
    });
    }, [selectedEmployees, policy, translate]);

    TO:

    const confirmModalPrompt = useMemo(() => {
        const approverAccountID = selectedEmployees.find((selectedEmployee) => Member.isApprover(policy, selectedEmployee));
        if (!approverAccountID) {
            return selectedEmployees.length === 1
                ? translate('workspace.people.removeMemberPrompt', {memberName: getDisplayNameForParticipant(selectedEmployees[0])})
                : translate('workspace.people.removeMembersPrompt');
        }
        return translate('workspace.people.removeMembersWarningPrompt', {
            memberName: getDisplayNameForParticipant(approverAccountID),
            ownerName: getDisplayNameForParticipant(policy?.ownerAccountID),
        });
    }, [selectedEmployees, policy, translate]);

What alternative solutions did you explore? (Optional)

@Krishna2323
Copy link
Contributor

PROPOSAL UPDATED

  • Updated main solution to include the changes for the prompt.

@allgandalf
Copy link
Contributor

@trjExpensify Can i be the C+ for this issue? I reported this bug on slack

@trjExpensify
Copy link
Contributor

Sure!

@trjExpensify trjExpensify added the External Added to denote the issue can be worked on by a contributor label Oct 2, 2024
@melvin-bot melvin-bot bot changed the title Plural Remove Members on the workspace members page even when we only have one member selected [$250] Plural Remove Members on the workspace members page even when we only have one member selected Oct 2, 2024
Copy link

melvin-bot bot commented Oct 2, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 2, 2024
Copy link

melvin-bot bot commented Oct 2, 2024

Current assignee @allgandalf is eligible for the External assigner, not assigning anyone new.

@nkdengineer
Copy link
Contributor

nkdengineer commented Oct 2, 2024

Edited by proposal-police: This proposal was edited at 2024-10-02 10:44:25 UTC.

Proposal

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

Remove members displayed even if only one member selected

What is the root cause of that problem?

We're always using workspace.people.removeMembersTitle without checking whether the selected employee is one or many

text: translate('workspace.people.removeMembersTitle'),

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

Following the same pattern of this translation we can update removeMembersTitle translation like this

removeMembersTitle: () => ({
    one: 'Remove member',
    other: 'Remove members',
}),
removeMembersTitle: () => ({
    one: 'Eliminar miembro',
    other: 'Eliminar miembros',
}),

deleteConfirmation: () => ({

Then for each place below, we only need to pass the count param as the length of the selected member to this translation to display the translation accordingly with the length of the selected member.

text: translate('workspace.people.removeMembersTitle'),

title={translate('workspace.people.removeMembersTitle')}

text: translate('workspace.people.removeMembersTitle'),

title={translate('workspace.people.removeMembersTitle')}

text: translate('workspace.people.removeMembersTitle'),

text: translate('workspace.people.removeMembersTitle'),

title={translate('workspace.people.removeMembersTitle')}

When we implement this, we should wrap this logic and other place that we use the new translation in InteractionsManager.runAfterInteraction or use Modal.close to ensure the modal is displayed correctly when we confirm delete.

https://github.com/nkdengineer/App/blob/487816184680744a2ad53a03460cbbdec363c432/src/pages/workspace/WorkspaceMembersPage.tsx#L211

OPTIONAL: We can make the same approach for removeMembersPrompt translation. And update all places that we're using removeMembersPrompt without checking the length of the selected member

removeMembersPrompt: ({memberName}: {memberName: string}) => ({
    one: `Are you sure you want to remove ${memberName}?`,
    other: 'Are you sure you want to remove these members?',
}),

removeMembersPrompt: 'Are you sure you want to remove these members?',

With this approach we can remove removeMemberTitle and removeMemberPrompt translation and use removeMembersTitle/removeMembersPrompt with count param as 1

What alternative solutions did you explore? (Optional)

@nkdengineer
Copy link
Contributor

Updated proposal

  • Fix another case.

@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2024
@allgandalf
Copy link
Contributor

I will review this on monday not overdue

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 5, 2024
@trjExpensify
Copy link
Contributor

@allgandalf did you review?

@melvin-bot melvin-bot bot removed the Overdue label Oct 7, 2024
@allgandalf
Copy link
Contributor

Sorry I was occupied with a deploy blocker yesterday, Reviewing now ♻️

@allgandalf
Copy link
Contributor

♻️ both @Krishna2323 's and @nkdengineer 's proposals solve this bug.

🟢 Both have the correct RCA which addresses why the bug occurs

💭 In particular I feel @nkdengineer 's proposal is a bit of over-engineering and @Krishna2323 's proposal is a simplified approach towards this bug. So I would leave it upto the internal engineer for this case which one to select.

I would prefer @Krishna2323 's proposal though.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 8, 2024

Triggered auto assignment to @rlinoz, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@nkdengineer
Copy link
Contributor

nkdengineer commented Oct 8, 2024

In particular I feel @nkdengineer 's #49961 (comment) is a bit of over-engineering

@allgandalf I don't think so.

  1. We already have a translation like this here

App/src/languages/en.ts

Lines 883 to 885 in 4878161

deleteConfirmation: () => ({
one: 'Are you sure that you want to delete this expense?',
other: 'Are you sure that you want to delete these expenses?',

title={translate('iou.deleteExpense', {count: selectedTransactionsKeys.length})}

InteractionManager.runAfterInteractions(() => {
clearSelectedTransactions();
});

  1. With this approach, we can get the translation cleaner everywhere we use this. We only need to pass to count param to this translation instead of has an if else in all places to get the title.

cc @rlinoz

@allgandalf
Copy link
Contributor

allgandalf commented Oct 8, 2024

Lets see what @rlinoz opinion is here 😄

@Krishna2323
Copy link
Contributor

We also have translation, as I suggested in my proposal, so I don't think that matters much. My proposal does solve the issue in a way that is commonly used in many places.

text: translate(selectedReportFields.length === 1 ? 'workspace.reportFields.delete' : 'workspace.reportFields.deleteFields'),

title={translate(selectedReportFields.length === 1 ? 'workspace.reportFields.delete' : 'workspace.reportFields.deleteFields')}

text: translate(selectedCategoriesArray.length === 1 ? 'workspace.categories.deleteCategory' : 'workspace.categories.deleteCategories'),

text: translate(enabledCategories.length === 1 ? 'workspace.categories.disableCategory' : 'workspace.categories.disableCategories'),

text: translate(disabledCategories.length === 1 ? 'workspace.categories.enableCategory' : 'workspace.categories.enableCategories'),

title={translate(selectedCategoriesArray.length === 1 ? 'workspace.categories.deleteCategory' : 'workspace.categories.deleteCategories')}
prompt={translate(selectedCategoriesArray.length === 1 ? 'workspace.categories.deleteCategoryPrompt' : 'workspace.categories.deleteCategoriesPrompt')}

text: translate(selectedValuesArray.length === 1 ? 'workspace.reportFields.deleteValue' : 'workspace.reportFields.deleteValues'),

text: translate(enabledValues.length === 1 ? 'workspace.reportFields.disableValue' : 'workspace.reportFields.disableValues'),

text: translate(disabledValues.length === 1 ? 'workspace.reportFields.enableValue' : 'workspace.reportFields.enableValues'),

title={translate(selectedValuesArray.length === 1 ? 'workspace.reportFields.deleteValue' : 'workspace.reportFields.deleteValues')}
prompt={translate(selectedValuesArray.length === 1 ? 'workspace.reportFields.deleteValuePrompt' : 'workspace.reportFields.deleteValuesPrompt')}

cc: @rlinoz

@rlinoz
Copy link
Contributor

rlinoz commented Oct 8, 2024

From the readme of the project it looks like we prefer to implement plurals with the count option, also checked internally and that is the general feel as well, so let's go with @nkdengineer's proposal

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 8, 2024
Copy link

melvin-bot bot commented Oct 8, 2024

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

Offer link
Upwork job

Copy link

melvin-bot bot commented Oct 8, 2024

📣 @nkdengineer 🎉 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 📖

@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 Weekly KSv2 labels Oct 9, 2024
@melvin-bot melvin-bot bot changed the title [$250] Plural Remove Members on the workspace members page even when we only have one member selected [HOLD for payment 2024-10-17] [$250] Plural Remove Members on the workspace members page even when we only have one member selected Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.47-4 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 2024-10-17. 🎊

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

Copy link

melvin-bot bot commented Oct 10, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@allgandalf] The PR that introduced the bug has been identified. Link to the PR:
  • [@allgandalf] 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:
  • [@allgandalf] A discussion in #expensify-bugs 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:
  • [@allgandalf] Determine if we should create a regression test for this bug.
  • [@allgandalf] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@trjExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@allgandalf
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: N/A (we never considered the case for singular/plural options

  • 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: N/A

  • A discussion in #expensify-bugs 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: N/A

  • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Proposal

  • Select any workspace from settings which have members
  • Click Members > select any added member
  • Click the dropdown in the 1 selected pill

Verify that: Remove member displayed as only one member selected

  • Click Remove member

Verify that: modal prompt displayed as only one member selected

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 17, 2024
@trjExpensify
Copy link
Contributor

It's a pretty minor language thang this, so I think we can skip the regression test.

Payment summary as follows:

Paid, closing!

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
Projects
No open projects
Status: Polish
Development

No branches or pull requests

6 participants