-
Notifications
You must be signed in to change notification settings - Fork 313
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(content-sidebar): remove dependency on isSignRemoveInterstitialEnabled #3734
base: master
Are you sure you want to change the base?
fix(content-sidebar): remove dependency on isSignRemoveInterstitialEnabled #3734
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.
One question and one small followup, if possible (can be another PR)
aea92d0
to
1020007
Compare
1020007
to
bdba5eb
Compare
bdba5eb
to
3b5d387
Compare
3b5d387
to
a982541
Compare
f4855fe
to
8fd8f2e
Compare
8fd8f2e
to
ba55f34
Compare
b0d2d93
to
8a40819
Compare
const FtuxTooltip = !isSignDisabled && isTargeted ? TargetedClickThroughGuideTooltip : PlaceholderTooltip; | ||
const label = intl.formatMessage(status === 'active' ? messages.boxSignSignature : messages.boxSignRequest); |
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.
removed this check because status property is not being passed anymore from EUA
cbf2ac3
to
f54b7ad
Compare
@@ -66,6 +67,7 @@ type Props = { | |||
onVersionChange?: Function, | |||
onVersionHistoryClick?: Function, | |||
versionsSidebarProps: VersionsSidebarProps, | |||
signSidebarProps: SignSideBarProps, |
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 like this is alphabetize, can we alphabetize this prop 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.
updated
}: Props) => { | ||
const { enabled: hasBoxSign } = useFeatureConfig('boxSign'); | ||
const { enabled: hasBoxSign } = signSideBarProps || {}; |
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.
is there a permission via the user that enables this feature 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.
Yes, there is a user permission controlled by the admin that enables/disables signing. This is reflected in the enabled
property sent by EUA
f54b7ad
to
8aed68f
Compare
8aed68f
to
60f54fc
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.
approved but this feature has remain undocumented, normally all props at the root level is usable by 3rd customers sine this feature is only enabled by a flag and additional unknown permissions internally, we cant guarantee the 3rd party customers will be able to use it.
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.
some minor things I think worth cleaning up
hasDocGen={docGenSidebarProps.isDocGenTemplate} | ||
signSideBarProps={signSidebarProps} | ||
isOpen={isOpen} | ||
onPanelChange={this.handlePanelChange} |
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.
nit:
hasDocGen={docGenSidebarProps.isDocGenTemplate} | |
signSideBarProps={signSidebarProps} | |
isOpen={isOpen} | |
onPanelChange={this.handlePanelChange} | |
hasDocGen={docGenSidebarProps.isDocGenTemplate} | |
isOpen={isOpen} | |
onPanelChange={this.handlePanelChange} | |
signSidebarProps={signSidebarProps} |
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.
want to emphasize typo: signSideBarProps
-> signSidebarProps
<SidebarNavSign {...props} /> | ||
</FeatureProvider>, | ||
); | ||
const defaultSignSideBarProps = { |
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.
nit:
the pattern we usually use for this it to have the renderComponent
function take a props parameter that can override the default props. this allows for testing different flows in the component:
const renderComponent = (props = {}) => {
const defaultProps = {
...
};
render(<SidebarNavSign {...defaultProps} {...props} />);
};
isSignRemoveInterstitialEnabled: isRemoveInterstitialEnabled, | ||
}, | ||
}; | ||
test('should render sign button', async () => { |
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.
you don't need async
here
renderComponent(); | ||
|
||
await userEvent.click(screen.getByRole('button', { name: 'Request Signature' })); |
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.
can we check that onClickSignMyself
hasn't been called yet before the user click?
boxSign: { | ||
isSignRemoveInterstitialEnabled: true, | ||
}, | ||
}; | ||
const { getByTestId } = renderComponent({}, features); | ||
fireEvent.click(getByTestId('sign-button')); | ||
expect(getByTestId('sign-request-signature-button')).toBeVisible(); | ||
expect(getByTestId('sign-sign-myself-button')).toBeVisible(); | ||
}); | ||
test('should call correct handler when request signature option is clicked', async () => { | ||
renderComponent(); | ||
|
||
test('should call correct handler when request signature option is clicked', () => { | ||
const features = { | ||
boxSign: { | ||
isSignRemoveInterstitialEnabled: true, | ||
onClick: onClickRequestSignature, | ||
}, | ||
}; | ||
const { getByTestId } = renderComponent({}, features); | ||
fireEvent.click(getByTestId('sign-button')); | ||
fireEvent.click(getByTestId('sign-request-signature-button')); | ||
expect(onClickRequestSignature).toBeCalled(); | ||
await userEvent.click(screen.getByRole('button', { name: 'Request Signature' })); |
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.
can we check that onClickRequestSignature
hasn't been called yet before the user click?
const onClickRequestSignature = jest.fn(); | ||
const onClickSignMyself = jest.fn(); |
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.
nit: usually we create these locally in the individual tests so that they're not reused across tests. otherwise, it's easy to overlook that if the mocks are not cleared properly, then their implementations and call counts would be carried over between tests.
const features = { | ||
boxSign: { | ||
const props = { | ||
signSideBarProps: { |
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.
nit
signSideBarProps: { | |
signSidebarProps: { |
@@ -87,6 +88,7 @@ type Props = { | |||
sharedLink?: string, | |||
sharedLinkPassword?: string, | |||
theme?: Theme, | |||
signSidebarProps: SignSideBarProps, |
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.
signSidebarProps: SignSideBarProps, | |
signSidebarProps: SignSidebarProps, |
theme, | ||
versionsSidebarProps, | ||
signSidebarProps, |
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.
theme, | |
versionsSidebarProps, | |
signSidebarProps, | |
signSidebarProps, | |
theme, | |
versionsSidebarProps, |
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.
some other locations need some alphabetizing as well. e.g. (line 416 in this file, line 74, 316, 352 in Sidebar.js
, etc.)
enabled: boolean; | ||
onClick: () => void; | ||
onClickSignMyself: () => void; | ||
targetingApi: TargetingApi | null; |
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.
targetingApi
is an optional prop in SidebarNavSignButton
. can this line align with that?
targetingApi: TargetingApi | null; | |
targetingApi?: TargetingApi; |
The isSignRemoveInterstitialEnabled feature flag was recently cleaned up on the application side, causing a production defect due to a dependency in this components. This PR removes the dependency in BUIE components to align with the application.
Also uses sign config in the primary props instead of feature props