Skip to content

[Due for payment 2025-02-27] [Due for payment 2025-02-18] [Due for payment 2025-02-13] [$500] [Auth Violations] Support isDismissed on newDot to hide violations #53398

@pecanoro

Description

@pecanoro

Part of the Auth Violations project

Main issue: https://github.com/Expensify/Expensify/issues/422533
Project: https://github.com/Expensify/Expensify/issues/393838

Feature Description

Currently we have four violations that can be dismissed in old Expensify:

  • DUPLICATED_TRANSACTION
  • SMARTSCAN_FAILED
  • RTER
  • AUTOREPORTED_REJECTED_EXPENSE (Not implemented in newDot yet)

If the violation has been dismissed, we don't show the violation to the user. In PHP, we currently have a function like this:

    /**
     * Checks whether a violation has been dismissed, optionally by a particular email address.
     *
     * @param string $violationName check Policy_Violation::NAME_*
     */
    public function isViolationDismissed(string $violationName, string $email = ''): bool
    {
        // If we don't provide an email, we just check if the violation has been dismissed by anyone
        if (!$email) {
            return count($this->getNVP('dismissedViolations')[$violationName] ?? []) > 0;
        }

        $timestamp = $this->getNVP('dismissedViolations')[$violationName][$email] ?? '';
        return strlen(strval($timestamp)) > 0;
    }

Note: The NVP is stored in the transaction's "comment" along with the rest of the name-value pairs.

Ideally, we should add this logic in newDot similar to what we did for duplicate transactions here. My best guess is that we need to make that logic work in these functions here so we stop showing the violation in the LHN and the transaction itself. However, I might be missing other spots.

Take into account that checking for dismissed violations should be optional in case there are flows in which we want to show it regardless or block submission because of that.

Manual Test Steps

  1. Scan a receipt in which the smartscan will fail (illegible or not a receipt)
  2. Go to old Expensify, find the report and dismiss the violation.
  3. Go back to new Expensify and make sure the violation is not showing anymore.
    Note: You might need to refresh the page, I am not sure if the BE is queueing these updates, let me know if not.

cc/ @cead22 @iwiznia

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021864348688314983900
  • Upwork Job ID: 1864348688314983900
  • Last Price Increase: 2024-12-11
  • Automatic offers:
    • rojiphil | Reviewer | 105371307
    • Krishna2323 | Contributor | 105371309
Issue OwnerCurrent Issue Owner: @johncschuster

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionExternalAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.WeeklyKSv2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions