-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Hide review box if user cannot review access requests #49785
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
describe('Request View', () => { | ||
test('renders review box if user can review', async () => { | ||
render(<RequestView {...sample} />); | ||
expect(screen.getByTestId(reviewBoxId)).toBeInTheDocument(); | ||
}); |
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 component didn't have tests before. I added this to test the functionality in this PR but if you feel strongly, I'll add more tests to test the other functionally not related to this PR.
web/packages/shared/components/AccessRequests/ReviewRequests/RequestView/RequestView.test.tsx
Outdated
Show resolved
Hide resolved
web/packages/shared/components/AccessRequests/ReviewRequests/RequestView/RequestView.test.tsx
Outdated
Show resolved
Hide resolved
web/packages/shared/components/AccessRequests/ReviewRequests/RequestView/RequestView.test.tsx
Outdated
Show resolved
Hide resolved
From what I see, |
web/packages/shared/components/AccessRequests/ReviewRequests/RequestView/RequestView.test.tsx
Outdated
Show resolved
Hide resolved
web/packages/shared/components/AccessRequests/ReviewRequests/RequestView/RequestView.test.tsx
Outdated
Show resolved
Hide resolved
oss counterpart for gravitational/teleport.e#5628 This adds some testing to the view as well as the equivalent to the web solution for Connect. Connect was missing the [recently added](#48536) `ReviewRequests` field in the user ACL, so I added it here. Because this is handled in the tsh code, we don't have to worry about backward compatibility here for Connect right?
4b95a0d
to
6ae11a3
Compare
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.
Sorry for a late review!
}; | ||
|
||
const props: RequestViewProps = { | ||
user: 'loggedInUsername', |
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.
FWIW, I'd put "Alice" here or whatever. When someone looks at this code for the first time, loggedInUsername
might seem as if someone wanted to use a variable 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.
Thats a great idea. Just realized that auto-merge was on so I wasn't able to change this. However, I have another PR in a similar space coming up soon that I'll toss the change in (i'll skip it in the backports to not cause weird conflicts when I'm doing the next PR too)
oss counterpart for
https://github.com/gravitational/teleport.e/pull/5628
This adds some testing to the view as well as the equivalent to the web solution for Connect. Connect was missing the recently added
ReviewRequests
field in the user ACL, so I added it here.Because this is handled in the tsh code, we don't have to worry about backward compatibility here for Connect right? If so, i could maybe do some default of true and only handle the false case but I don't think it's necessary