15m44p 工单附件列表视图解码 images + GitHub 关 issue 带 state_reason
- api/ticket.php: ticketMyList/ticketListAll 返回前 decodeTicketImages 把 images JSON 串解码成数组(与 ticketDetail 对齐)。旧版列表给前端的是字符串, applyTicketImgs(desc, t.images) 收字符串导致 [图片N] 占位符替换不到、 @gh: 附件名渲染不出来(用户实测'附件还是不对'根因)。 - gh_api.php: ghSyncClose 关 issue 加 state_reason——完结→completed(GitHub 显示 done)、驳回→not_planned(显示 not planned)。旧版只传 state=closed 不带 reason, GitHub 不会改成 done/not-planned 语义。
This commit is contained in:
+6
-2
@@ -199,9 +199,13 @@ function ghSyncClose($ticketId, $kind, $token, $sender = 'admin') {
|
||||
$closeComment = ($kind === 'completed')
|
||||
? GH_TICKET_PREFIX . $ticketId . '][' . $sender . '] ✅ 工单已完结'
|
||||
: GH_TICKET_PREFIX . $ticketId . '][' . $sender . '] 🚫 工单已驳回';
|
||||
// 先评论(留痕)再关 issue
|
||||
// 先评论(留痕)
|
||||
ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/comments', ['body' => $closeComment], $token);
|
||||
$r = ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/close', ['state' => 'closed'], $token);
|
||||
// ★ 15m44p: 关 issue 带 state_reason —— 完结→completed(GitHub显示done) / 驳回→not_planned(显示not planned)
|
||||
// 旧版只传 state=closed 没带 reason,GitHub 不会改成 done/not-planned 语义。
|
||||
$stateReason = ($kind === 'rejected') ? 'not_planned' : 'completed';
|
||||
$r = ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/close',
|
||||
['state' => 'closed', 'state_reason' => $stateReason], $token);
|
||||
if (!$r['ok']) ghLog('close issue #' . $issueNo . ' failed: ' . $r['msg']);
|
||||
return $r['ok'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user