-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
feat: add policyReportFields to the policy object directly #36553
Conversation
@aimane-chnaif 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] |
@Expensify/contributor-plus anyone who first comment here please take over. |
I can! |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-app-2024-03-20_16.14.21.mp4Android: mWeb Chromeandroid-chrome-2024-03-20_16.25.42.mp4iOS: Nativeios-app-2024-03-20_15.51.30.mp4iOS: mWeb Safariios-safari-2024-03-20_14.44.59.mp4MacOS: Chrome / Safaridesktop-chrome-2024-03-20_15.46.57.mp4MacOS: Desktopdesktop-app-2024-03-20_16.04.08.mp4 |
Co-authored-by: Joel Davies <joeld.dev@gmail.com>
@allroundexperts I guess we don't support disabling dropdown options here yet? If I disable a bunch on OD it doesn't have any effect on ND. |
@allroundexperts I guess this step is no longer relevant. |
I don't remember adding it although @thienlnam can confirm. |
Just a note that the BE still doesn't seem to be sending pusher updates when fields are deleted in OD, so it requires signing out & back in for those changes to show. |
chrome-pusher-2024-03-20_16.08.20.mp4 |
@jjcoffee Can you please share the url you see at top when the not found page is seen? |
Looks to me like the pusher is sending back the fields without the expensify prefix. |
@allroundexperts Bingo! |
Ah actually it's the same URL that gets opened after refresh. |
Can you check what pusher sends back when you add a field? |
Looks like it only updates the fields on the policy, not the report. "updates": [
{
"data": [
{
"key": "policy_6D05DA21B79C2F3A",
"onyxMethod": "merge",
"value": {
"fieldList": {
"field_id_TESTING_PUSHER": {
"defaultExternalID": null,
"defaultValue": null,
"deletable": false,
"disabledOptions": [],
"externalID": null,
"externalIDs": [],
"fieldID": "field_id_TESTING_PUSHER",
"isTax": false,
"keys": [],
"name": "Testing Pusher",
"orderWeight": 4,
"origin": null,
"target": "expense",
"type": "text",
"value": null,
"values": []
}
}
}
}
],
"eventType": "onyxApiUpdate"
} |
That's fine. The issue is that pusher is not appending |
Ah yeah I see the policy has duplicate fields with/without the |
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.
LGTM! There's just a BE fix required to the pusher updates (see this comment), but that doesn't need to block this PR.
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.
Awesome - thanks for this!
✋ 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/thienlnam in version: 1.4.56-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.56-8 🚀
|
fieldName={Str.UCFirst(reportField.name)} | ||
fieldValue={fieldValue} | ||
fieldOptions={reportField.values} | ||
fieldOptions={reportField.values.filter((value) => !(value in reportField.disabledOptions))} |
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.
This was not the right way to check if a value is in an array in javascript. It caused this deploy blocker: #38898
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.
Ugh... I hate when this happens 😢. I was super sure that this won't happen again.
* Get the key for a report field | ||
*/ | ||
function getReportFieldKey(reportFieldId: string) { | ||
return `expensify_${reportFieldId}`; |
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.
Adding expensify_
prefix to all fieldID
cause a problem with the title fieldID text_title
which shouldn't have this prefix, and we dealt with in #40464
fieldName={Str.UCFirst(reportField.name)} | ||
fieldValue={fieldValue} | ||
fieldOptions={reportField.values} | ||
fieldOptions={reportField.values.filter((value) => !(value in reportField.disabledOptions))} |
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.
Here, we should have used policyField
instead of reportField
.
Issue: #48827
if (isReportFieldTitle) { | ||
ReportActions.updateReportName(report.reportID, value, report.reportName ?? ''); | ||
} else { | ||
ReportActions.updateReportField(report.reportID, {...reportField, value}, reportField); | ||
ReportActions.updateReportField(report.reportID, {...reportField, value: value === '' ? null : value}, reportField); |
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.
We should check the value exist before updating the report field. Ref: #47067
Details
This PR adds the policy report fields to the policy object itself instead of a separate
policyFields_id
object.Fixed Issues
$ #36170
PROPOSAL: N/A
Tests
canUseReportFields
beta is enabled.Offline tests
Same as above. Verify that everything works in offline mode.
QA Steps
canUseReportFields
beta is enabled.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
Android: Native
Screen.Recording.2024-03-20.at.5.50.33.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-03-20.at.5.49.51.PM.mov
iOS: Native
Screen.Recording.2024-03-20.at.5.48.23.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-03-20.at.5.46.56.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-03-20.at.5.42.37.PM.mov
MacOS: Desktop
Screen.Recording.2024-03-20.at.5.44.59.PM.mov