fix(留言分頁): 改用 timeline 分頁讀取留言
Gitea 議題留言端點無法可靠處理分頁;改由 timeline 逐頁篩選 comment 事件並去重,讓抽取、整併與 PR 留言流程取得完整集合。
This commit is contained in:
+3
-8
@@ -24,6 +24,7 @@ import {
|
||||
ScriptError,
|
||||
expectOk,
|
||||
giteaRequest,
|
||||
listIssueComments,
|
||||
main,
|
||||
pages,
|
||||
parseFlags,
|
||||
@@ -205,14 +206,8 @@ async function findInline(login, repo, index, commentId) {
|
||||
}
|
||||
|
||||
async function findGeneral(login, repo, index, commentId) {
|
||||
const path = `/repos/${repo}/issues/${index}/comments`;
|
||||
|
||||
for await (const comments of pages(login, path, {
|
||||
limitCode: 'COMMENT_LIMIT',
|
||||
limitHint: `${path} 的留言太多,找不完`,
|
||||
})) {
|
||||
const hit = comments.find((comment) => comment.id === commentId);
|
||||
if (hit) return hit;
|
||||
for await (const comment of listIssueComments(login, repo, index)) {
|
||||
if (comment.id === commentId) return comment;
|
||||
}
|
||||
throw notFound(index, '一般留言', commentId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user