fix(report): carry the admin note into the reporter result email
update_status() fired aksrt_report_status_changed without the note and
the mail listener hard-coded note => '', so the reply-to-reporter
comment written in the process form never reached the email. Pass the
sanitized note as a 4th action arg, render it via the existing {note}
placeholder, and map the raw status key to its Chinese label in the
email body. Contract test extended accordingly.
This commit is contained in:
@@ -140,10 +140,11 @@ class ReportCenter {
|
||||
];
|
||||
$format = ['%s', '%s'];
|
||||
|
||||
if ($note !== '') {
|
||||
$note_clean = $note !== '' ? sanitize_textarea_field($note) : '';
|
||||
if ($note_clean !== '') {
|
||||
$notes = json_decode($existing->notes_json ?? '[]', true) ?? [];
|
||||
$notes[] = [
|
||||
'note' => sanitize_textarea_field($note),
|
||||
'note' => $note_clean,
|
||||
'status' => $new_status,
|
||||
'operator' => get_current_user_id(),
|
||||
'timestamp' => current_time('mysql'),
|
||||
@@ -154,7 +155,8 @@ class ReportCenter {
|
||||
|
||||
$result = $wpdb->update($table, $update_data, ['id' => $report_id], $format, ['%d']);
|
||||
if ($result !== false) {
|
||||
do_action('aksrt_report_status_changed', $report_id, (int) ($existing->reporter_id ?? 0), $new_status);
|
||||
// 第 4 参携带处理说明:邮件通知(report_result)需要反馈给举报人。
|
||||
do_action('aksrt_report_status_changed', $report_id, (int) ($existing->reporter_id ?? 0), $new_status, $note_clean);
|
||||
}
|
||||
return $result !== false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user