15m44z 第三部分续:匿名工单回复去玩家名 + token 保留 + 匿名开关 UI
匿名工单(gh_issue_owner=bot)回复/撤单/完结不再在 GitHub 评论写提单人名字; ghSyncReply 按 gh_issue_owner 判:bot 单省略 [sender] 标签,实名单保留; ticketReply 加 guard:bot 单+玩家 token 不匹配时静默跳过评论推送; gh_cfg.php:切匿名模式时玩家 OAuth token 保留(gh_authorized 兜底 true); player.php:匿名开时授权按钮改保留授权不隐藏,匿名关恢复重新授权。
This commit is contained in:
@@ -889,6 +889,25 @@ function ticketReply() {
|
||||
// ★ 15m44z 第三部分:回复按工单 issue 归属派发——bot 建的单→机器人代发评论,
|
||||
// 实名单→玩家 OAuth token(老逻辑)。ghTicketTokenByTicket 内部按 gh_issue_owner 判。
|
||||
$ghToken = ghTicketTokenByTicket($id);
|
||||
// ★ 15m44z 第三部分:bot 工单 + 玩家 OAuth token 不匹配(ghTicketTokenByTicket 回退
|
||||
// 到 ghTicketToken 时,gh_issue_owner 未记录但匿名模式开→走 bot 路径拿 ghs_ token;
|
||||
// 若拿到的还是 gho_/ghp_ 玩家 token 但工单归属 bot,说明 token 不匹配→ 静默跳过
|
||||
// 评论推送(不暴露玩家名字)。
|
||||
if (strpos($ghToken, 'gho_') === 0 || strpos($ghToken, 'ghp_') === 0) {
|
||||
try {
|
||||
$dbGh = getDB();
|
||||
$stO = $dbGh->prepare("SELECT gh_issue_owner FROM web_tickets WHERE id = :id LIMIT 1");
|
||||
$stO->bindValue(':id', $id, SQLITE3_INTEGER);
|
||||
$oRow = $stO->execute()->fetchArray(SQLITE3_ASSOC);
|
||||
$owner = ($oRow && isset($oRow['gh_issue_owner'])) ? (string)$oRow['gh_issue_owner'] : '';
|
||||
if ($owner === 'bot') {
|
||||
// bot 工单但拿到玩家 token → 归属不匹配,静默跳过(避免暴露玩家名)
|
||||
ghLog('reply skipped: bot ticket with player token ticket=' . $id);
|
||||
success(['gh_synced' => false, 'gh_label' => false], '回复成功');
|
||||
return;
|
||||
}
|
||||
} catch (\Throwable $ignored) {}
|
||||
}
|
||||
$ghSyncOk = ghSyncReply($id, $message, $ghToken, $player);
|
||||
$ghLabel = ghSyncLabel($id, 'user_reply', $ghToken);
|
||||
} catch (\Throwable $ignored) { $ghSyncOk = false; $ghLabel = false; }
|
||||
|
||||
Reference in New Issue
Block a user