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:
@@ -24,7 +24,7 @@ final class MailNotifications {
|
||||
add_action('aksrt_new_posts_pending', [self::class, 'post_pending'], 20, 1);
|
||||
add_action('transition_post_status', [self::class, 'post_status_changed'], 20, 3);
|
||||
add_action('aksrt_report_submitted', [self::class, 'report_submitted'], 20, 2);
|
||||
add_action('aksrt_report_status_changed', [self::class, 'report_status_changed'], 20, 3);
|
||||
add_action('aksrt_report_status_changed', [self::class, 'report_status_changed'], 20, 4);
|
||||
add_action('aksrt_friend_link_submitted', [self::class, 'friend_link_submitted'], 20, 1);
|
||||
add_action('aksrt_user_phone_changed', [self::class, 'phone_changed'], 20, 2);
|
||||
add_action('aksrt_user_restriction_changed', [self::class, 'restriction_changed'], 20, 4);
|
||||
@@ -179,9 +179,24 @@ final class MailNotifications {
|
||||
self::send_admin('report_admin', ['username' => $reporter instanceof \WP_User ? $reporter->display_name : __('用户', 'aksrt'), 'title' => (string) ($report['target_type'] ?? ''), 'url' => admin_url('users.php?page=aksrt_user_ban')]);
|
||||
}
|
||||
|
||||
public static function report_status_changed(int $report_id, int $reporter_id, string $status): void {
|
||||
public static function report_status_changed(int $report_id, int $reporter_id, string $status, string $note = ''): void {
|
||||
$reporter = get_userdata($reporter_id);
|
||||
if ($reporter instanceof \WP_User) self::send('report_result', $reporter->user_email, ['username' => $reporter->display_name, 'status' => $status, 'note' => '', 'url' => home_url('/')]);
|
||||
if (!$reporter instanceof \WP_User) {
|
||||
return;
|
||||
}
|
||||
// 状态值中文化后进入邮件;处理说明来自后台“处理说明”输入(钩子第 4 参)。
|
||||
$labels = [
|
||||
'pending' => __('待处理', 'aksrt'),
|
||||
'reviewing' => __('审核中', 'aksrt'),
|
||||
'resolved' => __('已解决', 'aksrt'),
|
||||
'dismissed' => __('已驳回', 'aksrt'),
|
||||
];
|
||||
self::send('report_result', $reporter->user_email, [
|
||||
'username' => $reporter->display_name,
|
||||
'status' => $labels[$status] ?? $status,
|
||||
'note' => $note !== '' ? $note : __('—', 'aksrt'),
|
||||
'url' => home_url('/'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function friend_link_submitted(array $link): void {
|
||||
|
||||
Reference in New Issue
Block a user