feat: withdraw delegated issues from Filed (Closes #884)
CI / lint (pull_request) Failing after 1m55s
CI / build-release (pull_request) Has been skipped
CI / browser-journey (pull_request) Has been skipped
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-15 10:00:46 +00:00
1 parent f01dfa5f93
commit 6a03dfd7ac
8 files changed
+159 -19

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ FEATURE_SOURCES = {
"static/draft-filing-session.js", "static/draft-capacity-dialog.js", "static/work-selection.js",
"static/today-work.js", "static/pick-work.js", "static/batch-find-work.js",
"static/search-batch-plan.js", "static/issue-evidence-review.js", "static/issue-evidence-editor.js",
"static/issue-attachment.js", "static/issue-filing-review.js", "static/issue-filing-receipt.js",
"static/issue-attachment.js", "static/issue-sheet.js", "static/issue-filing-review.js", "static/issue-filing-receipt.js",
),
}
CACHE_DECLARATION = re.compile(
+16 -1
View File
@@ -1253,13 +1253,16 @@ async def close_issue(repository: str, number: int) -> dict:
issue = response.json()
if not isinstance(issue, dict) or issue.get("state") != "closed":
raise ValueError("Gitea did not confirm issue closure")
return {
result = {
"number": issue.get("number"),
"state": "closed",
"closed_at": issue.get("closed_at", "")
if isinstance(issue.get("closed_at"), str)
else "",
}
if isinstance(issue.get("updated_at"), str):
result["updated_at"] = issue["updated_at"]
return result
def _normalize_issue_comment(comment: dict) -> dict:
@@ -2423,6 +2426,18 @@ async def is_authored_issue(repository: str, number: int) -> bool:
)
async def is_open_authored_issue(repository: str, number: int) -> bool:
login, issue = await _current_login_and_target(
f"repos/{repository}/issues/{number}"
)
author = issue.get("user") if isinstance(issue.get("user"), dict) else {}
return (
issue.get("state") == "open"
and not isinstance(issue.get("pull_request"), dict)
and author.get("login") == login
)
async def pull_requests() -> WorkItems:
assigned, review_requested = await asyncio.gather(
work_page("pull"),
+14 -4
View File
@@ -5296,6 +5296,7 @@ async def close_assigned_issue(
owner: str,
repo: str,
number: int = PathParam(gt=0),
access: Literal["assigned", "filed"] = "assigned",
step_up_grant: str | None = Header(
default=None, alias="X-Step-Up-Grant", max_length=128
),
@@ -5310,12 +5311,21 @@ async def close_assigned_issue(
target = f"{repository}#{number}"
try:
assigned = await asyncio.wait_for(
gitea_proxy.is_assigned_issue(repository, number),
authorized = await asyncio.wait_for(
(
gitea_proxy.is_open_authored_issue(repository, number)
if access == "filed"
else gitea_proxy.is_assigned_issue(repository, number)
),
timeout=ISSUE_ACTION_TIMEOUT_SECONDS,
)
if not assigned:
raise HTTPException(status_code=404, detail="Assigned issue not found")
if not authorized:
detail = (
"Open authored issue not found"
if access == "filed"
else "Assigned issue not found"
)
raise HTTPException(status_code=404, detail=detail)
journal = _security_event_store()
operation_id = await asyncio.to_thread(
journal.reserve,