TP-39196 | fixed empty createdBy and updatedBy in houston-ui in case it was done by a non slack user (crm agent) (#138)
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package slackbot
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/slack-go/slack"
|
||||
"github.com/thoas/go-funk"
|
||||
"go.uber.org/zap"
|
||||
@@ -18,7 +16,8 @@ func (c *Client) GetUsersInfo(users ...string) (*[]slack.User, error) {
|
||||
usersInfoResponse, err := c.socketModeClient.GetUsersInfo(splittedUsersList[usersList]...)
|
||||
if err != nil {
|
||||
c.logger.Error("get users info failed", zap.Any("users", splittedUsersList[usersList]), zap.Error(err))
|
||||
return nil, fmt.Errorf("get users info failed. err: %v", err)
|
||||
emptyArray := make([]slack.User, len(splittedUsersList))
|
||||
return &emptyArray, nil
|
||||
}
|
||||
usersInfo = append(usersInfo, *usersInfoResponse...)
|
||||
}
|
||||
|
||||
@@ -182,8 +182,17 @@ func (i *incidentService) GetIncidentResponseFromIncidentEntity(
|
||||
incidentResponses[incidentIndex].StatusName = is.Name
|
||||
}
|
||||
}
|
||||
incidentResponses[incidentIndex].CreatedBy = userEmailMappings[incidents[incidentIndex].CreatedBy]
|
||||
incidentResponses[incidentIndex].UpdatedBy = userEmailMappings[incidents[incidentIndex].UpdatedBy]
|
||||
if userEmailMappings[incidents[incidentIndex].CreatedBy] != "" {
|
||||
incidentResponses[incidentIndex].CreatedBy = userEmailMappings[incidents[incidentIndex].CreatedBy]
|
||||
} else {
|
||||
incidentResponses[incidentIndex].CreatedBy = incidents[incidentIndex].CreatedBy
|
||||
}
|
||||
|
||||
if userEmailMappings[incidents[incidentIndex].UpdatedBy] != "" {
|
||||
incidentResponses[incidentIndex].UpdatedBy = userEmailMappings[incidents[incidentIndex].UpdatedBy]
|
||||
} else {
|
||||
incidentResponses[incidentIndex].UpdatedBy = incidents[incidentIndex].UpdatedBy
|
||||
}
|
||||
}
|
||||
return incidentResponses, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user