Fix bd-206: Handle status transitions and closed_at constraint
- Updated manageClosedAt to handle both string and types.Status type assertions - Added equalTime function for comparing timestamps in import change detection - Added tests for open→closed and closed→open transitions - Added comment clarifying closed_at is managed automatically The bug occurred when UpdateIssue received types.Status instead of string, causing manageClosedAt to skip setting closed_at when status changed to closed. Amp-Thread-ID: https://ampcode.com/threads/T-ee774f6d-3b90-4311-976d-60c8dd8fe677 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -1170,8 +1170,14 @@ func manageClosedAt(oldIssue *types.Issue, updates map[string]interface{}, setCl
|
||||
return setClauses, args
|
||||
}
|
||||
|
||||
newStatus, ok := statusVal.(string)
|
||||
if !ok {
|
||||
// Handle both string and types.Status
|
||||
var newStatus string
|
||||
switch v := statusVal.(type) {
|
||||
case string:
|
||||
newStatus = v
|
||||
case types.Status:
|
||||
newStatus = string(v)
|
||||
default:
|
||||
return setClauses, args
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user