Skip to content

Commit

Permalink
Remove wcor_send_after_and_no_report.
Browse files Browse the repository at this point in the history
  • Loading branch information
renintw committed May 28, 2024
1 parent 06a380b commit db6adc4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function test_timed_messages_sent( $send_when, $send_when_period, $send_w
'post_status' => $wordcamp_post_status,
) );

if ( in_array( $send_when, array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_after_and_no_report' ) ) ) {
if ( in_array( $send_when, array( 'wcor_send_before', 'wcor_send_after' ) ) ) {
update_post_meta( self::$wordcamp_dayton_post_id, 'Start Date (YYYY-mm-dd)', $compare_date );
} elseif ( 'wcor_send_after_pending' === $send_when ) {
update_post_meta( self::$wordcamp_dayton_post_id, '_timestamp_added_to_planning_schedule', $compare_date );
Expand Down Expand Up @@ -235,15 +235,6 @@ public function data_timed_messages_sent() {
strtotime( 'now - 3 days' ),
'wcpt-scheduled',
),

// After the camp ends and no transparency report is received.
array(
'wcor_send_after_and_no_report',
'wcor_send_days_after_and_no_report',
3,
strtotime( 'now - 3 days' ),
'wcpt-scheduled',
),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,6 @@
</td>
</tr>

<tr>
<th><input id="wcor_send_after_and_no_report" name="wcor_send_when" type="radio" value="wcor_send_after_and_no_report" <?php checked( $post->wcor_send_when, 'wcor_send_after_and_no_report' ); ?>></th>
<td>
<label for="wcor_send_after_and_no_report">after the camp ends and no transparency report is received: </label>
<br>
<span>(This will only be triggered when the 'Running money through WPCS PBC' is <strong>NOT</strong> checked)</span>
</td>
<td>
<input id="wcor_send_days_after_and_no_report" name="wcor_send_days_after_and_no_report" type="text" class="small-text" value="<?php echo esc_attr( $post->wcor_send_days_after_and_no_report ); ?>" />
<label for="wcor_send_days_after_and_no_report">days</label>
</td>
</tr>

<tr>
<th><input id="wcor_send_trigger" name="wcor_send_when" type="radio" value="wcor_send_trigger" <?php checked( $post->wcor_send_when, 'wcor_send_trigger' ); ?>></th>
<td><label for="wcor_send_trigger">on a trigger: </label></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public function send_timed_emails() {
'meta_query' => array(
array(
'key' => 'wcor_send_when',
'value' => array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_after_pending', 'wcor_send_after_and_no_report' ),
'value' => array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_after_pending' ),
'compare' => 'IN'
),
),
Expand Down Expand Up @@ -658,23 +658,6 @@ protected function timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_
if ( $days_after_pending && $timestamp_added_to_pending_schedule ) {
$execution_timestamp = $timestamp_added_to_pending_schedule + ( $days_after_pending * DAY_IN_SECONDS );

if ( $execution_timestamp <= current_time( 'timestamp' ) ) {
$ready = true;
}
}
} elseif ( 'wcor_send_after_and_no_report' == $send_when ) {
$through_wpcs_pbc = get_post_meta( $wordcamp->ID, 'Running money through WPCS PBC', true );

if ( $through_wpcs_pbc ) {
return $ready;
}

$days_after_and_no_report = absint( get_post_meta( $email->ID, 'wcor_send_days_after_and_no_report', true ) );
$report_received = get_post_meta( $wordcamp->ID, 'Transparency Report Received', true );

if ( $end_date && $days_after_and_no_report && ! $report_received ) {
$execution_timestamp = $end_date + ( $days_after_and_no_report * DAY_IN_SECONDS );

if ( $execution_timestamp <= current_time( 'timestamp' ) ) {
$ready = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function save_post_meta( $post, $new_meta ) {
}

if ( isset( $new_meta['wcor_send_when'] ) ) {
if ( in_array( $new_meta['wcor_send_when'], array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_after_pending', 'wcor_send_after_and_no_report', 'wcor_send_trigger' ) ) ) {
if ( in_array( $new_meta['wcor_send_when'], array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_after_pending', 'wcor_send_trigger' ) ) ) {
update_post_meta( $post->ID, 'wcor_send_when', $new_meta['wcor_send_when'] );
}
}
Expand All @@ -215,10 +215,6 @@ protected function save_post_meta( $post, $new_meta ) {
update_post_meta( $post->ID, 'wcor_send_days_after_pending', absint( $new_meta['wcor_send_days_after_pending'] ) );
}

if ( isset( $new_meta['wcor_send_days_after_and_no_report'] ) ) {
update_post_meta( $post->ID, 'wcor_send_days_after_and_no_report', absint( $new_meta['wcor_send_days_after_and_no_report'] ) );
}

if ( isset( $new_meta['wcor_which_trigger'] ) ) {
if ( in_array( $new_meta['wcor_which_trigger'], array_merge( array( 'null' ), array_keys( $GLOBALS['WCOR_Mailer']->triggers ) ) ) ) {
update_post_meta( $post->ID, 'wcor_which_trigger', $new_meta['wcor_which_trigger'] );
Expand Down

0 comments on commit db6adc4

Please sign in to comment.