[WIP] feat: expose Accounting suggested searches to Auditors#89513
Open
KJ21-ENG wants to merge 2 commits intoExpensify:mainfrom
Open
[WIP] feat: expose Accounting suggested searches to Auditors#89513KJ21-ENG wants to merge 2 commits intoExpensify:mainfrom
KJ21-ENG wants to merge 2 commits intoExpensify:mainfrom
Conversation
|
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Update getSuggestedSearchesVisibility in src/libs/SearchUIUtils.ts to treat the workspace Auditor role the same as Admin for the four Accounting-section eligibility flags (Unapproved cash, Unapproved card, Expensify Card, Reimbursements). Auditors already have read access to all reports on the workspace, so hiding the Accounting suggested-search shortcuts from them was inconsistent. The change mirrors the existing isAuditor handling on the Top Spenders flag a few lines below. Fixes Expensify#89173
7571f1a to
fdc1b73
Compare
Cover the new (isAdmin || isAuditor) branch in getSuggestedSearchesVisibility for: - unapprovedCash (Auditor passes, User does not) - unapprovedCard (Auditor passes, User does not) - reconciliation (Auditor passes via Expensify-Card branch) Plus regression checks that User stays excluded and Admin behaviour is unchanged.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Visibility of the Accounting section's suggested searches in the Search left navigation is computed in
getSuggestedSearchesVisibilityinsrc/libs/SearchUIUtils.ts. Four of the section's eligibility flags were gated strictly onisAdmin:isEligibleForUnapprovedCashSuggestion(Unapproved cash)isEligibleForUnapprovedCardSuggestion(Unapproved card)isEligibleForExpensifyCardSuggestion(Reconciliation — Expensify Card branch)isEligibleForReimbursementsSuggestion(Reconciliation — Reimbursements branch)RECONCILIATIONitself is the OR of the latter two, so it was admin-only as well.isAuditorwas already computed in the same loop and used forisEligibleForTopSpendersSuggestion, but it was never extended to the Accounting-section flags. As a result, members with the read-onlyAuditorrole — who already have visibility into every report on the workspace — saw an empty/missing Accounting section even though hiding the shortcuts gave them no security benefit (they can manually search for the same reports).This PR hoists the existing
isAuditordeclaration to sit besideisAdminand replacesisAdminwith(isAdmin || isAuditor)in the four Accounting-section eligibility expressions, matching the pattern already used for Top spenders a few lines below.EXPORTandSTATEMENTSeligibility are intentionally not modified — they are not admin-gated today and behave the same for Auditors as for any non-exporter member.No backend, API, or Onyx-key changes are required.
Fixed Issues
$ #89173
PROPOSAL: #89173 (comment)
Tests
Pre-requisites: a paid (Collect / Control / Track for Teams) workspace with Approvals on (Basic or Advanced), Payments on, and Expensify Cards enabled. Two test accounts where Account A is Owner/Admin and Account B will be flipped to Auditor.
https://dev.new.expensify.com:8082, open Spend and confirm the Accounting section in the left rail shows at least Cash accruals and Bank reconciliation.https://dev.new.expensify.com:8082and hard-refresh.Offline tests
QA Steps
Same prerequisites as Tests. Reproduce on
staging.new.expensify.comonce this is merged and deployed.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Verified on macOS Safari (staging — bug present) and macOS Chrome (dev server with this PR's fix — Auditor now sees
Bank reconciliationin the Accounting section). Drag-and-drop the before/after screenshots here.