-
Notifications
You must be signed in to change notification settings - Fork 800
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
Protect: Fix ThreatFixHeader component title #38312
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Protect plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
@@ -35,7 +35,7 @@ const FixAllThreatsModal = ( { threatList = [] } ) => { | |||
if ( ! checked ) { | |||
setThreatIds( threatIds.filter( id => id !== threat.id ) ); | |||
} else { | |||
setThreatIds( threatIds.push( threat.id ) ); | |||
setThreatIds( [ ...threatIds, threat.id ] ); |
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.
Good catch and nice fix!
@@ -53,7 +53,7 @@ const ThreatAccordionItem = ( { | |||
event.preventDefault(); | |||
setModal( { | |||
type: 'FIX_THREAT', | |||
props: { id, label, title, icon, severity, fixable }, | |||
props: { id, fixable, title, icon, severity }, |
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.
Using title
makes sense to me, does this affect the handleIgnoreThreatClick()
method above this one as well? i.e. can we potentially remove the getLabel()
method entirely?
I'm not sure why the label was not displaying in the first place, since we're generating the value programmatically. Maybe an issue of not using callback/memo hooks? I'm just testing to verify that, and then I'll approve this PR 👍 👍
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've gone through this in more detail now and discovered that we don't generate the label
prop for the threats list in advance of rendering this particular modal, whereas we do in others. Getting rid of the getLabel
methods doesn't appear to be a logical solution either as we use that property in a variety of other location in the scan UI. Therefor, I've opted to reassess and bring in the label prop to the FixAllThreatsModal
by generating the property initially directly within the useThreatsList
hook, rather than the location that list is passed to.
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!
Fix
ThreatFixHeader
component that displays for each threat in theFixAllThreatsModal
is missing the title element.threatIds
array to be fixed when initiated.Proposed changes:
Fix all threats
button in the modal when all threats are unselectedhandleCheckboxClick
functionality to avoid console errorsOther information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Fix all threat
or within an individual threat accordion itemFix threat
Fix all threats
modal ensure that you can unselect all threats, that theFix all
button becomes disabled, and that you can reselect threats (without console errors) and theFix all
buttons becomes available once againScreenshots:
Single threat:
Before w/ multiple threats:
After w/ multiple threats: