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

[Pending Payment][$250] IOU - mWeb - Duplicate red dot error not shown in conversation & report page #46375

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 27, 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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 27, 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.13
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Login with new gmail account
  3. Create a new workspace
  4. Tap on a workspace chat
  5. Create 2 expenses with same amount and merchant
  6. Open each expense and note duplicate red dot shown under merchant

Expected Result:

Duplicate red dot error must be shown in conversation & report page

Actual Result:

Duplicate red dot error not shown in conversation & report page but error displayed in expense details page

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

Add any screenshot/video evidence

Bug6554809_1722096890143.review.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0102ecd093c6e7220c
  • Upwork Job ID: 1818074477646562605
  • Last Price Increase: 2024-08-06
  • Automatic offers:
    • nyomanjyotisa | Contributor | 103430539
Issue OwnerCurrent Issue Owner: @
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 27, 2024
Copy link

melvin-bot bot commented Jul 27, 2024

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

@lanitochka17
Copy link
Author

@VictoriaExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@nyomanjyotisa
Copy link
Contributor

nyomanjyotisa commented Jul 28, 2024

Proposal

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

Duplicate red dot error not shown in conversation & report page

What is the root cause of that problem?

We don't set shouldShowRBR to true if there is any duplicate here

const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold);

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

create new variable to check if there is any duplicate

const hasDuplicates = duplicates.length > 0;

And include it in shouldShowRBR

const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold) || hasDuplicates;

Need to move this code above the hasDuplicates declaration

What alternative solutions did you explore? (Optional)

The type of duplicate violation is warning so it wont be included to the shouldShowRBR since it only check hasNoticeTypeViolations or hasViolations

create new variable to check if it has violation with warning type

const hasWarningTypeViolation = TransactionUtils.hasWarningTypeViolation(transaction?.transactionID ?? '-1', transactionViolations);

And include it in shouldShowRBR

const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold) || hasWarningTypeViolation;

RESULT

-1-New-Expensify.12.mp4

@nyomanjyotisa
Copy link
Contributor

Proposal updated

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jul 28, 2024

Proposal

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

IOU - mWeb - Duplicate red dot error not shown in conversation & report page

What is the root cause of that problem?

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

We need to also check for Warning type of violations when policy is a paid group and user has beta access. For this we have several options:

  1. We can remove hasNoticeTypeViolations and TransactionUtils.hasNoticeTypeViolation and modify TransactionUtils.hasViolation util function to accept third param shouldCheckOnlyViolationType which will be used to determine if we want to also consider Notice & Warning type of violations. If needed we can also modify this function to accept separate param for including notice and warning type.
    /**
    * Checks if any violations for the provided transaction are of type 'violation'
    */
    function hasViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolations>): boolean {
    return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some(
    (violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.VIOLATION,
    );
    }
/**
 * Checks if any violations for the provided transaction are of type 'violation'
 */
function hasViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolations>, shouldCheckOnlyViolationType: boolean): boolean {
    return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => {
        if (shouldCheckOnlyViolationType) {
            return violation.type === CONST.VIOLATION_TYPES.VIOLATION;
        }
        return true;
    });
} 
  1. We can modify TransactionUtils.hasNoticeTypeViolation function to also check for Warning type violations and we can change its name to TransactionUtils.hasOtherTypesViolation.
    /**
    * Checks if any violations for the provided transaction are of type 'notice'
    */
    function hasNoticeTypeViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>): boolean {
    return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.NOTICE);
    }
/**
 * Checks if any violations for the provided transaction are of type 'notice'
 */
function hasOtherTypesViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>): boolean {
    return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some(
        (violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.NOTICE || violation.type === CONST.VIOLATION_TYPES.WARNING,
    );
}
  1. We can use TransactionUtils.hasWarningTypeViolation in MoneyRequestPreviewContent.tsx just like we are TransactionUtils.hasNoticeTypeViolation
    /**
    * Checks if any violations for the provided transaction are of type 'warning'
    */
    function hasWarningTypeViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>): boolean {
    if (!Permissions.canUseDupeDetection(allBetas ?? [])) {
    return false;
    }
    return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.WARNING);
    }
    const hasWarningTypeViolations = !!(
        TransactionUtils.hasWarningTypeViolation(transaction?.transactionID ?? '-1', transactionViolations) &&
        ReportUtils.isPaidGroupPolicy(iouReport) &&
        canUseViolations
    );
    const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold) || hasWarningTypeViolations;

Also include hasWarningTypeViolations here:

} else if (hasNoticeTypeViolations && transaction && !ReportUtils.isReportApproved(iouReport) && !ReportUtils.isSettled(iouReport?.reportID)) {

Some improvements that can be made:

  • We can check for similar uses of transaction violations throughout the app and try to refactor it if needed.
  • In useViolations.ts we already have similar kind of logic to include all type of violations.
    /**
    * @param violations – List of transaction violations
    * @param shouldShowOnlyViolations – Whether we should only show violations of type 'violation'
    */
    function useViolations(violations: TransactionViolation[], shouldShowOnlyViolations: boolean) {
  • In MoneyRequestPreviewContent we should only return true for hasWarningTypeViolations and hasWarningTypeViolation when receipt is not being scanned.

What alternative solutions did you explore? (Optional)

@VictoriaExpensify
Copy link
Contributor

Issue reproducible:

screen-20240730-095731.mp4

Agree this is buggy and should be fixed. Also agree this relates to VSB

@VictoriaExpensify VictoriaExpensify added the External Added to denote the issue can be worked on by a contributor label Jul 30, 2024
Copy link

melvin-bot bot commented Jul 30, 2024

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

@melvin-bot melvin-bot bot changed the title IOU - mWeb - Duplicate red dot error not shown in conversation & report page [$250] IOU - mWeb - Duplicate red dot error not shown in conversation & report page Jul 30, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 30, 2024
Copy link

melvin-bot bot commented Jul 30, 2024

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

@thesahindia
Copy link
Member

@nyomanjyotisa, do you know what types of cases come under warning-type violations? We need to determine whether we need the red dot error for all warning-type violations cases or just for the duplicate case.

@nyomanjyotisa
Copy link
Contributor

I'm not sure about all the cases for warning-type violations. I think we should ask in Slack

@Krishna2323
Copy link
Contributor

@cead22 @JmillsExpensify, can you please take a look here? Do we need to show the red dot on preview for all warnings or just for duplicate?

@cead22
Copy link
Contributor

cead22 commented Aug 2, 2024

Just for duplicates and for violations with type = violation. So I think the first proposal is more correct. @pecanoro what do you think?

Copy link

melvin-bot bot commented Aug 5, 2024

@VictoriaExpensify, @thesahindia Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@pecanoro
Copy link
Contributor

pecanoro commented Aug 6, 2024

Yes, what @cead22 said sounds good!

@thesahindia
Copy link
Member

let's go with @nyomanjyotisa's proposal.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 6, 2024

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

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

melvin-bot bot commented Aug 7, 2024

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

@pecanoro
Copy link
Contributor

pecanoro commented Aug 7, 2024

Assigning @nyomanjyotisa to the issue

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 8, 2024
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Sep 2, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

This issue has not been updated in over 15 days. @stitesExpensify, @VictoriaExpensify, @nyomanjyotisa, @thesahindia eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Sep 2, 2024
@pecanoro
Copy link
Contributor

pecanoro commented Sep 3, 2024

Did automatization fail for this issue? It seems it's ready to be paid

@pecanoro pecanoro added Daily KSv2 and removed Monthly KSv2 labels Sep 3, 2024
@pecanoro pecanoro changed the title [$250] IOU - mWeb - Duplicate red dot error not shown in conversation & report page [Pending Payment][$250] IOU - mWeb - Duplicate red dot error not shown in conversation & report page Sep 3, 2024
@pecanoro pecanoro added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Sep 3, 2024
@VictoriaExpensify
Copy link
Contributor

Yeah it has - will get on it. Thanks for flagging @pecanoro

@VictoriaExpensify VictoriaExpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Sep 4, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 4, 2024
Copy link

melvin-bot bot commented Sep 4, 2024

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

@VictoriaExpensify
Copy link
Contributor

Payment summary:
Contributor: @nyomanjyotisa paid $250 via Upwork
Contributor+: @thesahindia owed $250 via NewDot

Sorry for the delayed payment, thanks for your work on this issue.

@garrettmknight
Copy link
Contributor

$250 approved for @thesahindia

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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
No open projects
Status: No status
Development

No branches or pull requests

9 participants