Merge pull request #1290 from navi-infra/infra-4079-cr-approve-flow-update
INFRA-4079 | Harinder | While approving the change request, context is set to approver. Changing the same to the person who raised the request
This commit is contained in:
@@ -258,22 +258,20 @@ public class ChangeRequestServiceImpl implements ChangeRequestService {
|
||||
"Change request: {} is approved. Initiated merging with current version of the manifest",
|
||||
changeRequestId);
|
||||
|
||||
final var manifest = manifestService.fetchByIdWithoutAuthorization(
|
||||
changeRequest.getManifestId());
|
||||
try {
|
||||
changeRequestSlackService.handleChangeRequestUpdate(manifest, changeRequest);
|
||||
} catch (Exception e) {
|
||||
log.error("Error updating slack message while mering CR id:{} of manifest:{} : {}",
|
||||
changeRequestId, manifest.fullName(), e.getMessage());
|
||||
}
|
||||
final var manifestMap = manifest.convertToMap();
|
||||
mergeCr(manifestMap, changeRequest);
|
||||
final var mergedManifest = objectMapper.convertValue(manifestMap, Manifest.class);
|
||||
|
||||
SecurityContext originalContext = SecurityContextHolder.getContext();
|
||||
var crCreatorContext = authUtil.getSecurityContextForUser(changeRequest.getCreatedBy());
|
||||
try {
|
||||
SecurityContextHolder.setContext(crCreatorContext);
|
||||
final var manifest = manifestService.fetchById(changeRequest.getManifestId());
|
||||
try {
|
||||
changeRequestSlackService.handleChangeRequestUpdate(manifest, changeRequest);
|
||||
} catch (Exception e) {
|
||||
log.error("Error updating slack message while mering CR id:{} of manifest:{} : {}",
|
||||
changeRequestId, manifest.fullName(), e.getMessage());
|
||||
}
|
||||
final var manifestMap = manifest.convertToMap();
|
||||
mergeCr(manifestMap, changeRequest);
|
||||
final var mergedManifest = objectMapper.convertValue(manifestMap, Manifest.class);
|
||||
manifestService.createOrUpdate(mergedManifest, true);
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(originalContext);
|
||||
|
||||
Reference in New Issue
Block a user