Skip to content

Commit

Permalink
fix: during project import, ensure that the Status field on the new p…
Browse files Browse the repository at this point in the history
…roject ONLY has the expected values
  • Loading branch information
timrogers committed Sep 22, 2024
1 parent c12d9af commit dc01344
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/commands/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,28 @@ const correlateCustomFieldOptions = (
}

for (const oldOption of oldOptions) {
const newOption = newOptions.find((option) => option.name === oldOption.name);
const correlatingNewOption = newOptions.find(
(option) => option.name === oldOption.name,
);

if (newOption) {
map.set(oldOption.id, newOption.id);
if (correlatingNewOption) {
map.set(oldOption.id, correlatingNewOption.id);
} else {
throw new Error(
`Unable to correlate custom field options - expected to find "${oldOption.name}" option`,
);
}
}

for (const newOption of newOptions) {
const correlatingOldOption = oldOptions.find(
(option) => option.name === newOption.name,
);

if (!correlatingOldOption) {
throw new Error(
`Unable to correlate custom field options - found unexpected "${newOption.name}" option`,
);
}
}

Expand Down

0 comments on commit dc01344

Please sign in to comment.