This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 65cbe82b0 fix(webhook): set resolution_date and lead_time_minutes on 
incident close (#8919)
65cbe82b0 is described below

commit 65cbe82b01a1b0d3735dbf06d4abb711bc180d45
Author: bujjibabukatta <[email protected]>
AuthorDate: Fri Jun 12 19:01:18 2026 +0530

    fix(webhook): set resolution_date and lead_time_minutes on incident close 
(#8919)
---
 backend/plugins/webhook/api/issues.go | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/backend/plugins/webhook/api/issues.go 
b/backend/plugins/webhook/api/issues.go
index 49ea72b51..f91a17166 100644
--- a/backend/plugins/webhook/api/issues.go
+++ b/backend/plugins/webhook/api/issues.go
@@ -265,6 +265,16 @@ func closeIssue(input *plugin.ApiResourceInput, err 
errors.Error, connection *mo
        }
        domainIssue.Status = ticket.DONE
        domainIssue.OriginalStatus = ``
+       now := time.Now()
+       if domainIssue.ResolutionDate == nil {
+               domainIssue.ResolutionDate = &now
+       }
+       if domainIssue.LeadTimeMinutes == nil || *domainIssue.LeadTimeMinutes 
== 0 {
+               if domainIssue.CreatedDate != nil {
+                       temp := 
uint(domainIssue.ResolutionDate.Sub(*domainIssue.CreatedDate).Minutes())
+                       domainIssue.LeadTimeMinutes = &temp
+               }
+       }
        // save
        err = tx.Update(domainIssue)
        if err != nil {
@@ -278,6 +288,15 @@ func closeIssue(input *plugin.ApiResourceInput, err 
errors.Error, connection *mo
                if err == nil {
                        domainIncident.Status = ticket.DONE
                        domainIncident.OriginalStatus = ``
+                       if domainIncident.ResolutionDate == nil {
+                               domainIncident.ResolutionDate = &now
+                       }
+                       if domainIncident.LeadTimeMinutes == nil || 
*domainIncident.LeadTimeMinutes == 0 {
+                               if domainIncident.CreatedDate != nil {
+                                       temp := 
uint(domainIncident.ResolutionDate.Sub(*domainIncident.CreatedDate).Minutes())
+                                       domainIncident.LeadTimeMinutes = &temp
+                               }
+                       }
                        // save
                        err = tx.Update(domainIncident)
                        if err != nil {

Reply via email to