TP-0000 | shifting inviting users logic in async func (#115)
This commit is contained in:
committed by
GitHub Enterprise
parent
6a946dab52
commit
a37a0607e3
@@ -144,17 +144,19 @@ func (isp *UpdateIncidentAction) IncidentUpdateStatus(callback slack.Interaction
|
||||
zap.String("user_id", user.ID), zap.Error(err))
|
||||
}
|
||||
|
||||
errMessage := util.PostIncidentStatusUpdateMessage(user.ID, result.Name, callback.View.PrivateMetadata, isp.client)
|
||||
if errMessage != nil {
|
||||
isp.logger.Error("post response failed for IncidentUpdateStatus", zap.Error(errMessage))
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
errMessage := util.PostIncidentStatusUpdateMessage(user.ID, result.Name, callback.View.PrivateMetadata, isp.client)
|
||||
if errMessage != nil {
|
||||
isp.logger.Error("post response failed for IncidentUpdateStatus", zap.Error(errMessage))
|
||||
return
|
||||
}
|
||||
|
||||
msgUpdate := NewIncidentChannelMessageUpdateAction(isp.client, isp.logger, isp.incidentService, isp.teamRepository, isp.severityRepository)
|
||||
msgUpdate.ProcessAction(incidentEntity.SlackChannel)
|
||||
if result.IsTerminalStatus && (incidentEntity.SeverityId != 1 && incidentEntity.SeverityId != 2) {
|
||||
isp.client.ArchiveConversation(callback.View.PrivateMetadata)
|
||||
}
|
||||
msgUpdate := NewIncidentChannelMessageUpdateAction(isp.client, isp.logger, isp.incidentService, isp.teamRepository, isp.severityRepository)
|
||||
msgUpdate.ProcessAction(incidentEntity.SlackChannel)
|
||||
if result.IsTerminalStatus && (incidentEntity.SeverityId != 1 && incidentEntity.SeverityId != 2) {
|
||||
isp.client.ArchiveConversation(callback.View.PrivateMetadata)
|
||||
}
|
||||
}()
|
||||
|
||||
var payload interface{}
|
||||
isp.client.Ack(*request, payload)
|
||||
|
||||
@@ -94,23 +94,22 @@ func (itp *IncidentUpdateTypeAction) IncidentUpdateType(callback slack.Interacti
|
||||
zap.String("user_id", user.ID), zap.Error(err))
|
||||
}
|
||||
|
||||
itp.addDefaultUsersToIncident(callback.View.PrivateMetadata, incidentEntity.TeamId)
|
||||
if len(strings.TrimSpace(teamEntity.OncallHandle)) > 0 {
|
||||
itp.tagOncallToIncident(int(incidentEntity.TeamId), callback.View.PrivateMetadata)
|
||||
}
|
||||
|
||||
severityEntity, err := itp.severityService.FindSeverityById(incidentEntity.SeverityId)
|
||||
if err != nil {
|
||||
itp.logger.Error("error in fetching severity in incident update type action", zap.String("channel", incidentEntity.SlackChannel),
|
||||
zap.Uint("incident_id", incidentEntity.ID), zap.Error(err))
|
||||
return
|
||||
} else if severityEntity == nil {
|
||||
itp.logger.Info("severity not found in incident update type action", zap.String("channel", incidentEntity.SlackChannel),
|
||||
zap.Uint("incident_id", incidentEntity.ID))
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
itp.addDefaultUsersToIncident(callback.View.PrivateMetadata, incidentEntity.TeamId)
|
||||
if len(strings.TrimSpace(teamEntity.OncallHandle)) > 0 {
|
||||
itp.tagOncallToIncident(int(incidentEntity.TeamId), callback.View.PrivateMetadata)
|
||||
}
|
||||
|
||||
severityEntity, err := itp.severityService.FindSeverityById(incidentEntity.SeverityId)
|
||||
if err != nil {
|
||||
itp.logger.Error("error in fetching severity in incident update type action", zap.String("channel", incidentEntity.SlackChannel),
|
||||
zap.Uint("incident_id", incidentEntity.ID), zap.Error(err))
|
||||
return
|
||||
} else if severityEntity == nil {
|
||||
itp.logger.Info("severity not found in incident update type action", zap.String("channel", incidentEntity.SlackChannel),
|
||||
zap.Uint("incident_id", incidentEntity.ID))
|
||||
return
|
||||
}
|
||||
errMessage := util.PostIncidentTypeUpdateMessage(
|
||||
user.ID, teamEntity.Name, severityEntity.Name, severityEntity.Description,
|
||||
incidentEntity.IncidentName, incidentEntity.Title, callback.View.PrivateMetadata, itp.socketModeClient)
|
||||
|
||||
Reference in New Issue
Block a user