fix(milestone): persist due_on on create and edit (#189)

Fixes https://gitea.com/gitea/gitea-mcp/issues/187

The `due_on` argument was declared in the `milestone_write` schema but never read by `createMilestoneFn` or `editMilestoneFn`, so `opt.Deadline` was always nil and the field was silently dropped. This reuses the existing `params.GetOptionalTime` helper that already handles the analogous `deadline` field on issues and pull requests.

---
This PR was written with the help of Claude Opus 4.7

Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/189
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-committed-by: silverwind <me@silverwind.io>
This commit is contained in:
silverwind
2026-05-12 00:21:18 +00:00
committed by silverwind
parent 9275c5a0e1
commit a77b54acdd
2 changed files with 86 additions and 0 deletions
+2
View File
@@ -177,6 +177,7 @@ func createMilestoneFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallT
if ok {
opt.Description = description
}
opt.Deadline = params.GetOptionalTime(req.GetArguments(), "due_on")
client, err := gitea.ClientFromContext(ctx)
if err != nil {
@@ -219,6 +220,7 @@ func editMilestoneFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToo
if ok {
opt.State = new(gitea_sdk.StateType(state))
}
opt.Deadline = params.GetOptionalTime(req.GetArguments(), "due_on")
client, err := gitea.ClientFromContext(ctx)
if err != nil {