Skip to content

Commit

Permalink
Forms: Fix encoding when feedback marked as spam (#41359)
Browse files Browse the repository at this point in the history
* Forms: Fix encoding when going from regular to spam and from spam to regular feedback

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13019465710

Upstream-Ref: Automattic/jetpack@fcd0921
  • Loading branch information
enejb authored and matticbot committed Jan 28, 2025
1 parent 4dd4e3f commit 346a3c8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This is an alpha version! The changes listed here are not final.
- Updated package dependencies.

### Fixed
- Form: Fix encoding when going from spam to regular type
- Forms: fix dark themes date picker styles
- Forms: fixed missing spacing bug in the feedback list view
- Forms: Fix permently deleting form reponses via the quicklinks
Expand Down
17 changes: 13 additions & 4 deletions src/contact-form/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1116,14 +1116,23 @@ public function grunion_ajax_spam() {
$post_type_object = get_post_type_object( $post->post_type );
$akismet_values = get_post_meta( $post_id, '_feedback_akismet_values', true );
if ( $_POST['make_it'] === 'spam' ) {
$post->post_status = 'spam';
$status = wp_insert_post( $post );

$status = wp_update_post(
array(
'ID' => $post_id,
'post_status' => 'spam',
)
);

/** This action is already documented in \Automattic\Jetpack\Forms\ContactForm\Admin */
do_action( 'contact_form_akismet', 'spam', $akismet_values );
} elseif ( $_POST['make_it'] === 'ham' ) {
$post->post_status = 'publish';
$status = wp_insert_post( $post );
$status = wp_update_post(
array(
'ID' => $post_id,
'post_status' => 'publish',
)
);

/** This action is already documented in \Automattic\Jetpack\Forms\ContactForm\Admin */
do_action( 'contact_form_akismet', 'ham', $akismet_values );
Expand Down

0 comments on commit 346a3c8

Please sign in to comment.