-
Notifications
You must be signed in to change notification settings - Fork 3k
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 - Room - Workspace the current user is not member appears in workspace list during room creation flow #53630
Fix - Room - Workspace the current user is not member appears in workspace list during room creation flow #53630
Conversation
@shubham1206agra 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] |
@@ -71,9 +71,10 @@ Onyx.connect({ | |||
* Filter out the active policies, which will exclude policies with pending deletion | |||
* These are policies that we can use to create reports with in NewDot. | |||
*/ | |||
function getActivePolicies(policies: OnyxCollection<Policy> | null): Policy[] { | |||
function getActivePolicies(policies: OnyxCollection<Policy> | null, currentUserLogin: string | undefined): 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.
Please don't modify this function. Instead use shouldShowPolicy
. Maybe implement function like getActiveAdminWorkspaces
to get filtered workspace.
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.
Why? I have checked all instances where we have used getActivePolicies
and additional check of roles is already the requirement. shouldShowPolicy
is not the correct choice because it returns pending delete policies when offline. There is no way a policy where the current user has no role can be considered an active policy and updating getActivePolicies will avoid similar bugs in the future too.
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.
Change shouldShowPolicy
to include logic from getActivePolicies
and remove the getActivePolicies
function altogether then.
it returns pending delete policies when offline
True, but we can control this via parameters.
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 don't see the advantage of doing that:
getActivePolicies
accepts policies list and returns only policies that are active while shouldShowPolicy
determines whether the policy should be shown or not (which allows pending delete policy when offline) and using additional param to use it for other purpose doesn't look like better approach to me a function should ideally serve one functionality.
@cristipaval WDYT about the above discussion
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 it is important to maintain the single responsibility principle for the functions. So yes, I think your suggestion makes sense, @FitseTLT. On the other hand, I think the function name might be a bit confusing, and I can see @shubham1206agra's concern. Maybe we could update the function doc and mention that we also filter based on the role since the users can have in Onyx policies that they are not members of.
@FitseTLT Please add unit tests. |
Added comment and test. |
what's the status here? |
@cristipaval I was experiencing problems in GH checkout. I will finish the review tomorrow. |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / SafariScreen.Recording.2024-12-14.at.7.15.34.PM.mov |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@shubham1206agra @cristipaval @FitseTLT this caused regression. See #54197 |
@lakchote Can you link the issue this PR caused pls ? |
Revert "Merge pull request #53630 from FitseTLT/fix-showing-workspace…
Details
Fixed Issues
$ #53315
PROPOSAL: #53315 (comment)
Tests
Precondition:
Account only has one workspace.
Invoices feature is enabled.
Offline tests
Same as above
QA Steps
Same as above
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(themeColors.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
a.worksp.mp4
Android: mWeb Chrome
aw.mp4
iOS: Native
i.mp4
iOS: mWeb Safari
iw.mp4
MacOS: Chrome / Safari
w.mp4
MacOS: Desktop
d.mp4