-
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
fix condition by adding check if taxes are enabled #52462
base: main
Are you sure you want to change the base?
fix condition by adding check if taxes are enabled #52462
Conversation
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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 pretty good and clean 👍
I left you 2 comments both related to code style/naming but not bugs.
Feel free to open this for review
return (numberOfFilters !== 0 || optionalCondition) && isFeatureEnabled; | ||
} | ||
|
||
function isFeatureEnabledInPolicies(policies: OnyxCollection<Policy>, featureName: PolicyFeatureName) { |
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 suggest an early return here instead of policies ?? {}
just do
if (emptyObject) {
return false
}
I found a util function in the code for checking this:
import {isEmptyObject} from '@src/types/utils/EmptyObject';
@@ -251,6 +252,14 @@ function getFilterInDisplayTitle(filters: Partial<SearchAdvancedFiltersForm>, _: | |||
: undefined; | |||
} | |||
|
|||
function shouldDisplayFilter(numberOfFilters: number, isFeatureEnabled: boolean, optionalCondition = false): boolean { |
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 argument name optionalCondition
is kinda confusing because of the very generic name.
In general this function feels a bit off because of it. Is it possible to not pass this argument, but instead call this function, and then in the place where you call it do something like:
const shouldDisplayXXX = shouldDisplayFilter(...) && !!singlePolicyTagLists
or similar?
@carlosmiceli 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
@sumo-slonik I think you're missing some checks. Let me know and I can review. |
@sumo-slonik please sign the CLA as instructed here |
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
Explanation of Change
I added a condition to the function that fetches tax information to check if the tax functionality is enabled for a given workspace. In addition, I fixed the same bug for:
Fixed Issues
#52378
Tests
Offline tests
No offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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
android.app_1.mp4
Android: mWeb Chrome
android.web.mp4
iOS: Native
ios.app_1.mp4
iOS: mWeb Safari
ios.app_2.mp4
MacOS: Chrome / Safari
desktop.web_1.mp4
MacOS: Desktop
desktop.app_1.mp4