Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Remove deprecated ReportUtils.getPolicy() method #39344
Remove deprecated ReportUtils.getPolicy() method #39344
Changes from 6 commits
04e8ed0
6364175
7f9b72e
cf89178
6f70c2f
185aa70
de509b5
dce5cb4
6a56163
448ad89
5eb8ee2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
NAB: you could DRY all these up by creating a similar
getPolicy()
method and then also ensuring thatgetPolicy()
isn't exported in the unit tests.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.
@nkdengineer Also should do the same thing in src/libs/actions/IOU.ts
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.
Could you test again to make sure everything works well after these updates?
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.
@DylanDylann please check again, i updated code and tested well
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.
@nkdengineer Look good but
getPolicy
function is duplicated@tgolen Should we create a utils function like this
And export it to use in all files
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.
Heh, the balance of DRYness here is difficult to get right. As soon as you export that method, we're back in the same spot that this PR is attempting to clean up. So, I think the DRYness here is acceptable IMO.
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 realized right after I posted it that this might not be clear. I am suggesting that we leave the duplicated methods and that it is OK in this instance for it to not be DRY so that no one is tempted to use the exported method when they shouldn't.
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.
My first instinct was that this component doesn't need to connect to the entire policy collection. It looks like the only reason it connects to the entire collection is pass all policies to
PolicyUtils.isPolicyMember()
. All that method does is check that Onyx contains a policy with that ID (which doesn't necessarily mean the user is a member).If that's all that
isPolicyMember()
is looking for, then it seems likeisPolicyMember
would betrue
as long as thepolicy
object returned here is not an empty object.Following that logic, then the full policy collection doesn't need to be subscribed to and
isPolicyMember
can be replaced with!isEmptyObject(policy)
.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.
@tgolen Thanks your suggestions. I just updated code, please check again @DylanDylann