Skip to content
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

Add Custom Description for Rollback Fixer #48738

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

jwidavid
Copy link
Contributor

@jwidavid jwidavid commented Jan 8, 2021

Changes proposed in this Pull Request

  • Jetpack Scan provides customized descriptions of how it will fix a threat. This PR adds a custom description for fixing threats with a "rollback".
    Example: Jetpack Scan will rollback the affected file to the version from January 8, 2021, 3:40 am.

Testing instructions

  • Use a test site with backup and scan plans
  • Ensure the site has at least one successful, full backup
  • Using the Threat Tester Plugin on your test site - add a "infect a file" threat. (You can get the plugin here)
  • Run calypso locally and initiate a scan of the test site
  • Verify that the threat was discovered and that a Fix is available
  • The description of the fix should read something like Jetpack Scan will rollback the affected file to the version from <date-and-time>.

@jwidavid jwidavid added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Feature] Scan The Jetpack Scan product labels Jan 8, 2021
@jwidavid jwidavid requested a review from a team January 8, 2021 17:39
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~44 bytes added 📈 [gzipped])

name  parsed_size           gzip_size
scan       +239 B  (+0.1%)      +44 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@singerb singerb requested a review from a team January 8, 2021 18:29
@singerb
Copy link

singerb commented Jan 8, 2021

Tagging Voyager in too, although this is a small change.

Copy link

@singerb singerb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed in wpcom\public_html\wp-content\lib\vaultpress\threat\class-threat.php that we're translating to real dates for the API, so simply displaying the target here is ok without the need for more parsing. Fine from my end.

@mattgawarecki
Copy link
Contributor

@singerb @jwidavid Will those dates from the API automatically come back in a locale-appropriate format for the user? I changed my WordPress.com account to use Japanese, but the timestamp still appears on the page for me as US-formatted.

@mattgawarecki
Copy link
Contributor

I should note that, other than the date format, everything showed up correctly for me. I'm sure our customers will appreciate this once it's merged 👍

@singerb
Copy link

singerb commented Jan 8, 2021

@singerb @jwidavid Will those dates from the API automatically come back in a locale-appropriate format for the user? I changed my WordPress.com account to use Japanese, but the timestamp still appears on the page for me as US-formatted.

No, it's a straight gmdate call with a format string. Since it's in WPCOM code we should be able to make it use locale-aware functions; I'm terrible at catching/doing things like that.

Copy link
Contributor

@mattgawarecki mattgawarecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's fixable in the back end without a ton of effort, I don't see any reason to hold up this PR. At worst, the date format will be incorrect for a bit. Approving for my part, but what do y'all think?

@singerb
Copy link

singerb commented Jan 8, 2021

Yes; it's better than the default fixer message and the date change should be able to be just swapping to use date_i18n() on the backend (https://developer.wordpress.org/reference/functions/date_i18n/ which I see used in WPCOM already).

@jwidavid jwidavid merged commit d20e7df into trunk Jan 11, 2021
@jwidavid jwidavid deleted the add/custom-message-for-rollback-fixer branch January 11, 2021 16:16
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 11, 2021
@a8ci18n
Copy link

a8ci18n commented Jan 11, 2021

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/5428521

Hi @jwidavid, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include all of the following strings:

  • Jetpack Scan will rollback the affected file to the version from %(version)s.
  • Jetpack Scan will rollback the affected file to an older (clean) version.

Thank you in advance!

@a8ci18n
Copy link

a8ci18n commented Jan 22, 2021

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Scan The Jetpack Scan product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants