Fix issue/PR add-assignee hitting a nonexistent endpoint (#158) #161
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/158-issue-add-assignee-endpoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #158.
fj issue edit --add-assignee <user>(and--remove-assignee, and the same flags onfj pr edit) errored with a spurious "not found" on an issue that exists.Root cause: the assignee edit POSTed/DELETEd to
/repos/{o}/{r}/issues/{n}/assignees. Forgejo has no such sub-resource (only labels do), so the request 404'd and the error UX rendered it as "not found: {o}/{r} #{n}". Confirmed live:GET .../issues/491/assigneesreturns 404 while the issue itself resolves.Fix: assignees are set through the issue PATCH endpoint, which replaces the whole list.
add_assignees/remove_assigneesnow read the current assignees and PATCH the merged set (union for add, difference for remove), keeping the additive CLI semantics. Works for PRs since they share the issues endpoint.Tests updated from the old sub-resource mocks to the GET + PATCH flow. Local: fmt, clippy (-D warnings), and
cargo test --all(514 passed) all green.Forgejo has no /issues/{n}/assignees sub-resource (only labels do), so add_assignees/remove_assignees got a 404 that surfaced as a spurious "not found" on an issue that exists. Read the current assignees and PATCH the issue with the merged set instead: additive for --add-assignee, subtractive for --remove-assignee. The same path backs fj pr edit. Tests updated to the GET + PATCH flow.