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:
Shashank Shekhar
2023-08-25 11:55:49 +05:30
committed by GitHub
parent cbb4292fd7
commit 5022f4e2cc
2 changed files with 13 additions and 5 deletions

View File

@@ -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...)
}

View File

@@ -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
}