feat(admin): redesign identity review with dialogs

Replace inline identity review forms with focused detail and review dialogs, improve list filters and caching, and align evidence permissions and deletion feedback. Add contract and runtime regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-30 20:05:21 +08:00
1 parent 5732be847e
commit bc26d62602
9 files changed
+2222 -116

No files matched your search

+6 -2
View File
@@ -83,7 +83,7 @@ final class EvidenceService {
/** @return array<int,array{id:int,url:string,thumbnail_url:string}> */
public function items(array $application, bool $admin = false): array {
$owner_id = (int) ($application['user_id'] ?? 0);
if ($owner_id <= 0 || ($admin ? !current_user_can('aksrt_review_identity') : get_current_user_id() !== $owner_id)) {
if ($owner_id <= 0 || ($admin ? !$this->can_review() : get_current_user_id() !== $owner_id)) {
return [];
}
$items = [];
@@ -111,7 +111,7 @@ final class EvidenceService {
wp_die(esc_html__('安全校验失败', 'aksrt'), '', ['response' => 403]);
}
$owner = (int) get_post_meta($id, self::OWNER_META, true);
if ($owner <= 0 || (get_current_user_id() !== $owner && !current_user_can('aksrt_review_identity'))) {
if ($owner <= 0 || (get_current_user_id() !== $owner && !$this->can_review())) {
wp_die(esc_html__('您没有权限查看该证明材料', 'aksrt'), '', ['response' => 403]);
}
$path = get_attached_file($id);
@@ -132,6 +132,10 @@ final class EvidenceService {
exit;
}
private function can_review(): bool {
return current_user_can('aksrt_review_identity') || current_user_can('manage_options');
}
/** @return array<int,array<string,mixed>>|\WP_Error */
private function normalize($input) {
if (!is_array($input) || empty($input['name'])) {