Skip to content

Commit

Permalink
feat(alerts): remove alert from test only if the latest alert is bein…
Browse files Browse the repository at this point in the history
…g archived
  • Loading branch information
harunbleech committed Mar 24, 2024
1 parent c67aff9 commit 40fa12e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/features/class-alerts-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,12 @@ public static function archive_alert( $alert_id = null, $is_false_positive = fal
$alert_result = Alert::set_alert_state( $alert_id, $new_alert_state );

// Add the alert from tests table -> this should stop testing.
$alert = (object) Alert::get_item( $alert_id );
Test::set_alert( $alert->post_id, null );
$alert = Alert::get_item( $alert_id );
$test = Test::get_item_by_post_id( $alert->post_id );

if ( $test->current_alert_id === $alert->id ) {
Test::set_alert( $alert->post_id, null );
}

if ( $is_false_positive ) {
$service = new Service();
Expand Down

0 comments on commit 40fa12e

Please sign in to comment.