Skip to content

Commit

Permalink
fix: display wrong owner's ip addressin certificate in bulk-send flow
Browse files Browse the repository at this point in the history
  • Loading branch information
raktima-opensignlabs committed Jul 31, 2024
1 parent 275167c commit 779a84c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/OpenSignServer/cloud/parsefunction/DocumentAftersave.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 779a84c

Please sign in to comment.