mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-18 05:35:50 +02:00
feat: create duplicate template functionality feat: add support of csv and xlsx for bulk contacts import feat: add info text for forms and dashboard button feat: implement functionality to delete a PDF page while editing the document feat: show completed documents in which signers included but not owner in completed reports feat: add delete folder button in opensign drive feat: introduce Bcc email support for sending completed documents feat: allow merging multiple pdf while drafting document and template feat: add 'My Initials' tab for auto-signing in request-sign flow feat: add support for redirect URL to navigate after document completion feat: introduce privacy policy and digital signature terms before signing documents. feat: add feature to allow adding new pages to existing document feat: add save signature, initials, stamp functionality in sign pad for logged in user feat: add preferences menu feat: add save custom email template, notifyonsignature, set timezone, allow signature types in preferences feat: secure local url feat: implement Italian language translation feat: implement German language translation feat: update menu name from report to documents and shift contactbook in main menu feat: provide edit contact functionality fix: unable to delete folder when all its documents are deleted fix: fields.push is not function fix: document loading issue in opensign drive fix: adjust the guest signature flow to display the document in full screen, eliminating any blank space which is displayed below the place holder in mobile view fix: resolve issue of instance of pdfdict or pdfstream but got undefined build(deps): update dependencies refactor: change note text from add contact form
47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
// Function to escape special characters in the search string
|
|
function escapeRegExp(string) {
|
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // Escape special characters
|
|
}
|
|
|
|
async function getContacts(searchObj, isJWT) {
|
|
try {
|
|
const escapedSearch = escapeRegExp(searchObj.search); // Escape the search input
|
|
const searchRegex = new RegExp(escapedSearch, 'i'); // Create regex once to reuse
|
|
const contactNameQuery = new Parse.Query('contracts_Contactbook');
|
|
contactNameQuery.matches('Name', searchRegex);
|
|
|
|
const conatctEmailQuery = new Parse.Query('contracts_Contactbook');
|
|
conatctEmailQuery.matches('Email', searchRegex);
|
|
|
|
// Combine the two queries with OR
|
|
const mainQuery = Parse.Query.or(contactNameQuery, conatctEmailQuery);
|
|
|
|
// Add the common condition for 'CreatedBy'
|
|
mainQuery.equalTo('CreatedBy', searchObj.CreatedBy);
|
|
mainQuery.notEqualTo('IsDeleted', true);
|
|
const findOpt = isJWT ? { useMasterKey: true } : { sessionToken: searchObj.sessionToken };
|
|
const contactRes = await mainQuery.find(findOpt);
|
|
const _contactRes = JSON.parse(JSON.stringify(contactRes));
|
|
return _contactRes;
|
|
} catch (err) {
|
|
console.log('err while fetch contacts', err);
|
|
throw err;
|
|
}
|
|
}
|
|
export default async function getSigners(request) {
|
|
const searchObj = { search: request.params.search || '', sessionToken: '' };
|
|
try {
|
|
if (request.user) {
|
|
searchObj.CreatedBy = { __type: 'Pointer', className: '_User', objectId: request?.user?.id };
|
|
searchObj.sessionToken = request.user.getSessionToken();
|
|
return await getContacts(searchObj);
|
|
}
|
|
else {
|
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'Invalid session token');
|
|
}
|
|
} catch (err) {
|
|
console.log('err in get signers', err);
|
|
throw err;
|
|
}
|
|
}
|