Skip to content

Commit

Permalink
Better descriptive variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kennsippell committed Dec 16, 2024
1 parent 23817bc commit 57dc8be
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/hierarchy-operations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ function replaceLineageInSingleContact(doc, moveContext) {
function updateContacts(options, constraints, moveContext) {
return moveContext.descendantsAndSelf
.map(descendant => {
const toDelete = (moveContext.merge && descendant._id === moveContext.sourceId) ||
(moveContext.mergePrimaryContacts && descendant._id === moveContext.sourcePrimaryContactId && moveContext.destinationPrimaryContactId);
const deleteSource = moveContext.merge && descendant._id === moveContext.sourceId;
const deletePrimaryContact = moveContext.mergePrimaryContacts
&& descendant._id === moveContext.sourcePrimaryContactId
&& moveContext.destinationPrimaryContactId;

if (toDelete) {
if (deleteSource || deletePrimaryContact) {
const toDeleteUsers = options.disableUsers && constraints.isPlace(descendant);
return {
_id: descendant._id,
Expand Down

0 comments on commit 57dc8be

Please sign in to comment.