From 779a84cf0be755379358c3c312a7b992a4a4b4f9 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 31 Jul 2024 20:15:07 +0530 Subject: [PATCH] fix: display wrong owner's ip addressin certificate in bulk-send flow --- .../cloud/parsefunction/DocumentAftersave.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/OpenSignServer/cloud/parsefunction/DocumentAftersave.js b/apps/OpenSignServer/cloud/parsefunction/DocumentAftersave.js index d01cef20d..1f5ae1b81 100644 --- a/apps/OpenSignServer/cloud/parsefunction/DocumentAftersave.js +++ b/apps/OpenSignServer/cloud/parsefunction/DocumentAftersave.js @@ -4,7 +4,8 @@ async function DocumentAftersave(request) { console.log('new entry is insert in contracts_Document'); const createdAt = request.object.get('createdAt'); const Folder = request.object.get('Type'); - const ip = request?.headers?.['x-real-ip'] || request.object?.get('OriginIp') || ''; + const ip = request?.headers?.['x-real-ip'] || ''; + const originIp = request?.object?.get('OriginIp') || ''; if (createdAt && Folder === undefined) { // console.log("IN If condition") const TimeToCompleteDays = request.object.get('TimeToCompleteDays') || 15; @@ -13,7 +14,9 @@ async function DocumentAftersave(request) { const documentQuery = new Parse.Query('contracts_Document'); const updateQuery = await documentQuery.get(request.object.id, { useMasterKey: true }); updateQuery.set('ExpiryDate', ExpiryDate); - updateQuery.set('OriginIp', ip); + if (!originIp) { + updateQuery.set('OriginIp', ip); + } const AutoReminder = request?.object?.get('AutomaticReminders') || false; if (AutoReminder) { const RemindOnceInEvery = request?.object?.get('RemindOnceInEvery') || 5; @@ -29,7 +32,9 @@ async function DocumentAftersave(request) { const documentQuery = new Parse.Query('contracts_Document'); const updateQuery = await documentQuery.get(request.object.id, { useMasterKey: true }); updateQuery.set('ExpiryDate', ExpiryDate); - updateQuery.set('OriginIp', ip); + if (!originIp) { + updateQuery.set('OriginIp', ip); + } const AutoReminder = request?.object?.get('AutomaticReminders') || false; if (AutoReminder) { const RemindOnceInEvery = request?.object?.get('RemindOnceInEvery') || 5;