From a8a1886f27eb3c01330b4c7f5f56f658581e11ec Mon Sep 17 00:00:00 2001 From: cfdaily Date: Fri, 12 Jun 2026 20:26:02 +0800 Subject: [PATCH] fix(toolchain): is_pr detection - check value not key existence Gitea Issue API returns pull_request: null for pure Issues (key exists but value is None). 'pull_request' in issue was always True, causing all Issue @mention mails to show 'PR #N' instead of 'Issue #N'. Fix: issue.get('pull_request') is not None --- src/api/toolchain_routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/toolchain_routes.py b/src/api/toolchain_routes.py index 1881558..e42f3cb 100644 --- a/src/api/toolchain_routes.py +++ b/src/api/toolchain_routes.py @@ -875,7 +875,7 @@ async def _handle_issue_comment(payload: Dict[str, Any]) -> None: mentions = extract_mentions(body, sender) if mentions: # 判断是 PR 还是 Issue(Gitea 中 PR 本质是特殊的 Issue) - is_pr = "pull_request" in issue + is_pr = issue.get("pull_request") is not None source_type = "PR" if is_pr else "Issue" mention_type = "PR @mention" if is_pr else "Issue @mention"