feat(upload): pending lifecycle for upload-on-select images

Mark front-end uploads (comment/ticket/report) as pending, return the
attachment id, discard own pending uploads on remove via
DELETE /upload/pending/{id}, claim referenced URLs on successful submit,
and purge unclaimed uploads older than 24h with an hourly cron.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-27 21:54:48 +08:00
1 parent a308f96837
commit ac3ed9c956
9 files changed
+247 -2

No files matched your search

+2
View File
@@ -337,6 +337,7 @@ final class TicketRestAdmin {
if ($id <= 0) {
return new \WP_Error('aksrt_ticket_db', __('工单创建失败', 'aksrt'), ['status' => 500]);
}
\AKSRT\Attachment\PendingUploads::claim_urls($attachment, get_current_user_id());
$ticket = TicketRepository::get_instance()->find($id);
if (is_array($ticket)) {
TicketNotifier::user_replied($ticket);
@@ -371,6 +372,7 @@ final class TicketRestAdmin {
if ($reply_id <= 0) {
return new \WP_Error('aksrt_ticket_db', __('回复提交失败', 'aksrt'), ['status' => 500]);
}
\AKSRT\Attachment\PendingUploads::claim_urls($attachment, get_current_user_id());
$repo->touch_reply($id, 'admin', get_current_user_id());
$repo->apply_reply_status($id, $ticket, 'admin');
TicketNotifier::user_replied($repo->find($id) ?? $ticket);