File tree Expand file tree Collapse file tree
common_services/src/services/member
data-access-layer/src/members Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -543,6 +543,9 @@ export async function unmergeMember(
543543 const newRoleId = await addMemberRole ( tx , { ...role , memberId : secondaryId } )
544544 if ( newRoleId ) {
545545 const isBlocked = orgAffiliationPolicies . get ( role . organizationId ) ?? false
546+ // Only org-level policy blocks are restored here. Pre-merge manual row-level
547+ // blocks and isPrimaryWorkExperience flags are not restored because the unmerge
548+ // backup does not carry override data.
546549 if ( isBlocked ) {
547550 await changeMemberOrganizationAffiliationOverrides ( tx , [
548551 {
Original file line number Diff line number Diff line change @@ -1102,11 +1102,13 @@ export async function mergeRoles(
11021102 secondaryAffiliationOverrides . some ( ( s ) => s . memberOrganizationId === r . role . id ) ,
11031103 )
11041104 if ( ! newRoleId ) {
1105+ // Use targetOrganizationId so the comparison works in both member-merge
1106+ // (org unchanged) and org-merge (secondary org -> primary org) contexts.
11051107 const directSecondaryRole = secondaryRoles . find ( ( role ) =>
11061108 secondaryAffiliationOverrides . some (
11071109 ( override ) =>
11081110 override . memberOrganizationId === role . id &&
1109- role . organizationId === addRole . organizationId &&
1111+ mergeStrat . targetOrganizationId ( role ) === addRole . organizationId &&
11101112 role . title === addRole . title ,
11111113 ) ,
11121114 )
You can’t perform that action at this time.
0 commit comments