-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[NoQA] Add BrickRoadsUtils #33239
[NoQA] Add BrickRoadsUtils #33239
Conversation
src/libs/BrickRoadsUtils.ts
Outdated
const getBrickRoadForPolicy = (policyReport: Report): BrickRoad => { | ||
const policyReportAction = ReportActionsUtils.getAllReportActions(policyReport.reportID); | ||
const reportErrors = OptionsListUtils.getAllReportErrors(policyReport, policyReportAction); | ||
const redBrickRoadIndicator = Object.keys(reportErrors ?? {}).length !== 0 ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we name this doesReportContainErrors
?
src/libs/BrickRoadsUtils.ts
Outdated
const reportErrors = OptionsListUtils.getAllReportErrors(policyReport, policyReportAction); | ||
const redBrickRoadIndicator = Object.keys(reportErrors ?? {}).length !== 0 ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined; | ||
if (redBrickRoadIndicator) { | ||
return 'RBR'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a constant for RBR
?
src/libs/BrickRoadsUtils.ts
Outdated
} | ||
const optionFromPolicyReport = {...policyReport, isUnread: ReportUtils.isUnread(policyReport), isUnreadWithMention: ReportUtils.isUnreadWithMention(policyReport)}; | ||
const shouldShowGreenDotIndicator = ReportUtils.requiresAttentionFromCurrentUser(optionFromPolicyReport, itemParentReportAction); | ||
return shouldShowGreenDotIndicator ? 'GBR' : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a constant for GBR
?
src/libs/BrickRoadsUtils.ts
Outdated
return {}; | ||
} | ||
|
||
const brickRoadsMap: Record<string, BrickRoad> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here that the key of this object should be a report ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WojtekBoman this seems like a method that might really take performance hit for the heavy accounts.
Could you please test this with the heavy account SWM got for auditing?
Also could you add reassure tests for these two methods using the measureFunction
as we need to make sure the performance does not regress here. Feel free to ask @OlimpiaZurek or @adhorodyski for help with those if needed
@WojtekBoman by the way, I'm still working on the backend API. I'll update you once the backend API PR is near completion 🙇 |
is this hold on the backend API? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hayata-suenaga I dont think this needs to wait for the backedn api as its not used in the app. We can then use these methods and test them in another PR which will get use of it
Reviewer Checklist
Screenshots/VideosThis is currently not used in the App and will be tested with the rest of the ideal nav implementation Android: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case, the code looks good to me
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.24-4 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.24-8 🚀
|
Details
This PR introduces
BrickRoadsUtils.ts
file in thesrc/libs
package. The new type has been defined in the new file:type BrickRoad = 'RBR' | 'GBR' | undefined
. The file contains two functions:The algorithm was implemented accordingly to the description that can be found in the design doc: https://docs.google.com/document/d/1VnEf2ThbbiQj0kx9KnAihF0DWf50s2Bn_MztEyEwtjg/edit#heading=h.70m1twt8rsqp
cc: @hayata-suenaga
Fixed Issues
$ #31878
PROPOSAL: described in the design doc: https://docs.google.com/document/d/1VnEf2ThbbiQj0kx9KnAihF0DWf50s2Bn_MztEyEwtjg/edit#heading=h.70m1twt8rsqp
Tests
To test the function, invoke getWorkspacesBrickRoads anywhere in the application and verify that the returned map contains valid data
Offline tests
To test the function, invoke getWorkspacesBrickRoads anywhere in the application and verify that the returned map contains valid data
QA Steps
To test the function, invoke getWorkspacesBrickRoads anywhere in the application and verify that the returned map contains valid data
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
This PR introduces only utility functions.
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop