-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Feature: Integrate OpenPolicyEditCardLimitTypePage api command to the app #47092
Feature: Integrate OpenPolicyEditCardLimitTypePage api command to the app #47092
Conversation
@dubielzyk-expensify @DylanDylann One of you needs to 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] |
If this has visual changes, then it'd be great to get screenshots for desktop and mobile to review 😄 |
@waterim Please ping me when the PR is ready |
Taking this over from @DylanDylann , slack, Can you resolve merge conflicts and get this ready for review @waterim , thanks |
@waterim , can you update videos on all platforms |
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.
Few comments, looks good in the first review
? 'workspace.expensifyCard.changeCardMonthlyLimitTypeWarning' | ||
: 'workspace.expensifyCard.changeCardSmartLimitTypeWarning'; | ||
? 'workspace.expensifyCard.changeCardSmartLimitTypeWarning' | ||
: 'workspace.expensifyCard.changeCardMonthlyLimitTypeWarning'; |
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.
If we have initialLimitType
as CONST.EXPENSIFY_CARD.LIMIT_TYPES.MONTHLY
then we should fallback to 'workspace.expensifyCard.changeCardMonthlyLimitTypeWarning'
like before right? I don't understand this change @waterim
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.
If we have initialLimitType as CONST.EXPENSIFY_CARD.LIMIT_TYPES.MONTHLY then we need to have SmartLimit warning because we are changing Monthly -> SmartLimit and warning will be for smartLimit and vise versa
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.
ahh that makes senes to me!
src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx
Outdated
Show resolved
Hide resolved
if (card.unapprovedSpend !== undefined && card.nameValuePairs?.limit) { | ||
// Spends are coming as negative numbers from the backend and we need to make it positive for the correct expression. | ||
const unapprovedSpend = Math.abs(card.unapprovedSpend); | ||
const isUnapprovedSpendOverLimit = unapprovedSpend >= card.nameValuePairs.limit; |
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.
const isUnapprovedSpendOverLimit = unapprovedSpend >= card.nameValuePairs.limit; | |
const isUnapprovedSpendOverLimit = unapprovedSpend > card.nameValuePairs.limit; |
Does it mention in the design doc that we should block spends exactly equal to the limit too ? if not then just drop the equals to case
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.
Yes, from this conversation
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.
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.
The Slack thread where @MariaHCD wrote this uses >=
but it makes sense to just be >. I would wait for Maria to confirm
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.
I think we should check for >=
Let's say the current limit type of the card is Fixed
and the admin wants to update the card to SmartLimit
If the unapprovedSpend
is exactly equal to the limit, the card would no longer be usable if the card were updated to SmartLimit
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.
Ah got it, thanks for the example
src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx
Outdated
Show resolved
Hide resolved
I will upload screenshots for all cases, but this PR is not about adding new UI, do we really need to have videos from all platforms? |
Not really, I can do that for you, the author checklist states:
But in this case i can do that for you, no worries |
@allgandalf Added all cases screenshots, also found one bug, will push in 1 min |
@allgandalf should be ready! |
@waterim what are the steps to get real data instead of the mock data? I am having trouble. I have connected bank account, but not able to add a virtual card and also get that card on the members details page |
if you have problems with createExpensifyCard maybe first checkout on the branch with ConfigureExpensifyCardsForPolicy #46564 This flow is not merged yet thats why you can't add new card without going on this PR |
Can you merge main @waterim , the linked PR was merged to main |
…icyEditCardLimitTypePage
@allgandalf merged |
Still trying to setup the card, @waterim I tried checkout out to that branch but not much lucj |
…icyEditCardLimitTypePage
Umm reassure test failed, maybe merge main again to trigger the workflow? |
Also why is CLA failing |
…icyEditCardLimitTypePage
@waterim , this has conflicts |
…icyEditCardLimitTypePage
Reviewer Checklist
Screenshots/VideosMacOS: 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.
Looks good to be merged
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.
One minor comment
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! One small comment
const validCombinations = [ | ||
[CONST.EXPENSIFY_CARD.LIMIT_TYPES.MONTHLY, CONST.EXPENSIFY_CARD.LIMIT_TYPES.SMART], | ||
[CONST.EXPENSIFY_CARD.LIMIT_TYPES.SMART, CONST.EXPENSIFY_CARD.LIMIT_TYPES.MONTHLY], | ||
[CONST.EXPENSIFY_CARD.LIMIT_TYPES.FIXED, CONST.EXPENSIFY_CARD.LIMIT_TYPES.SMART], |
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 could also be updating a fixed limit card to monthly?
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.
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.
So Fixed -> Monthly should be included in validCombinations, correct?
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.
According to the docs, Yes!
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.
Cool, @waterim could you update this? :)
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.
They are OoO until monday :)
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.
Ah, okay, I've just pushed a commit to add 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/MariaHCD in version: 9.0.21-0 🚀
|
Let's check this one off. We can test these internally (via full E2E tests) at a later stage. |
🚀 Deployed to production by https://github.com/Beamanator in version: 9.0.21-4 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.0.21-4 🚀
|
Details
Integrate OpenPolicyEditCardLimitTypePage api command to the app
Fixed Issues
$ #46959
$ #45924
PROPOSAL: N/A
Tests
Pre-step:
Comment out the feature check in the WorkspaceExpensifyCardDetailsPage file, so you can access the screen.
Also don't forget to disable policy?.areExpensifyCardsEnabled here
Go through these steps from here:
Offline tests
Same as tests
QA Steps
None
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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
unapprovedSpend > limit and changing MONTHLY -> SMART
unapprovedSpend > limit and changing SMART -> MONTLY
totalSpend > limit
unapprovedSpend > limit and changing FIXED -> SMART