-
Notifications
You must be signed in to change notification settings - Fork 384
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
Update validation model with auto-accepted (instead of forcibly sanitized) and statuses for new-accepted/new-rejected #1429
Conversation
* Add unapproved comment styling for new validation rows. * Show new accepted/rejected. * Let reject link be red and accept link be green.
…ate VALIDATION_ERROR_NEW_ACCEPTED_STATUS
3e94b3a
to
de7b04b
Compare
…pdate/validation-statuses # Conflicts: # assets/src/amp-validation-error-detail-toggle.js # tests/validation/test-class-amp-invalid-url-post-type.php
* Show notice when there are rejected validation errors which are new or acknowledged. * Update messages based on simplified logic for serving non-AMP native with errors.
3d13afd
to
4375a40
Compare
…pdate/validation-statuses
…rors See #1413 Also fixes eslint error
…pdate/validation-statuses # Conflicts: # assets/src/amp-validation-error-detail-toggle.js # tests/validation/test-class-amp-invalid-url-post-type.php
@amedina This is ready for initial testing according to the revised debugging workflow. PTAL and check if it aligns with your expectations. |
@amedina There is now a “Clear Empty” button that appears when there are validation errors with no associated URLs (i.e. they have all been forgotten): |
…pdate/validation-statuses
…pdate/validation-statuses
.row-actions .amp_validation_error_reject > a { | ||
color: #a00; | ||
} | ||
|
||
.notice.accept-reject-error { | ||
display: flex; | ||
} |
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.
In a different CSS file, what do you think about changing this width to 20%
:
The 'status' icon sometimes appears above the <select>
when the <select>
is wider. Though this happens for all of them at slightly more narrow screen widths.
This width: 20%
seems to work well in my testing so far:
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 styling issue isn't caused by this PR, it's just more apparent when the <select>
has longer text, like 'New Rejected'
instead of 'Rejected'
.
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.
Applied in 276c5a5
* @param array $assoc_args Associative args. | ||
* @throws Exception If an error happens. | ||
*/ | ||
public function reset_site_validation( $args, $assoc_args ) { |
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.
Great idea, this is something I've had to do manually with longer WP-CLI commands to delete the error posts and terms.
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.
* @param int[] $groups Term groups. | ||
* @return string SQL. | ||
*/ | ||
public static function prepare_term_group_in_sql( $groups ) { |
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.
Great idea to abstract this into a method.
/* translators: %s is number of errors rejected */ | ||
_n( | ||
'Rejected %s error. It will continue to block related URLs from being served as AMP.', | ||
'Rejected %s errors. They will continue to block related URLs from being served as AMP.', |
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.
if ( $message ) { | ||
printf( '<div class="notice notice-success is-dismissible"><p>%s</p></div>', esc_html( $message ) ); | ||
// Show success message for clearing empty terms. | ||
if ( isset( $_GET[ self::VALIDATION_ERRORS_CLEARED_QUERY_VAR ] ) ) { // WPCS: csrf ok. |
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.
@@ -513,6 +705,38 @@ public function test_add_error_type_clauses_filter() { | |||
$this->assertEquals( $initial_clauses, apply_filters( $tested_filter, $initial_clauses, $taxonomies ) ); | |||
} | |||
|
|||
/** | |||
<<<<<<< HEAD |
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.
It looks like this is still here from resolving the (many) merge conflicts.
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.
Fixed with cd20106
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
Hi @westonruter,
This looks really good, and the errors appeared as expected.
There are some minor points here, one related to styling.
There was an issue in the width of this before, but it's more apparent with longer text like 'New Accepted'.
This was in a DocBlock, so it didn't have any effect. But this removes the <<<<HEAD.
We currently have 3 term statuses:
So what we talked about was combining new with both accepted and rejected to then have 4:
0b00
0b01
0b11
0b10
In this arrangement, we have a nice feature: a bitmask of
0b10
will match all acknowledged (not-new) validation errors, whereas a bitmask of0b01
will match all accepted validation errors (regardless of whether new or acknowledged).amp
attribute is removed from thehtml
element.wp amp reset-site-validation
command to purge site of validation data.Todo
wp_update_term_count_now()
for each term to make sure it is actually 0 before we go ahead and delete them.Update filters so that “Accepted” matches both new and acknowledged, and the same for “Rejected” (which should be linked to from auto-accept checkbox label). New can match both new-accepted and new-rejected still.(To explore at another time, seeupdate/error-status-dropdown-options
branch)Delete taxonomy terms entirely when an invalid URL post is deleted. When the count goes to zero.