Repository navigation
[NoQA] Add BrickRoadsUtils - #33239
Conversation
| 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.
should we name this doesReportContainErrors?
| 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.
is there a constant for RBR?
| } | ||
| 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.
is there a constant for GBR?
| return {}; | ||
| } | ||
|
|
||
| const brickRoadsMap: Record<string, BrickRoad> = {}; |
There was a problem hiding this comment.
can you add a comment here that the key of this object should be a report ID?
mountiny
left a comment
There was a problem hiding this comment.
@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? |
mountiny
left a comment
There was a problem hiding this comment.
@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 |
hayata-suenaga
left a comment
There was a problem hiding this comment.
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.tsfile in thesrc/libspackage. 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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
This PR introduces only utility functions.
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop