App
App copied to clipboard
[$250] [Auth Violations] Support isDismissed on newDot to hide violations
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
- Scan a receipt in which the smartscan will fail (illegible or not a receipt)
- Go to old Expensify, find the report and dismiss the violation.
- 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-04