Skip to content

Commit

Permalink
[backend] fix tests (#7944)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Nov 19, 2024
1 parent 99fc069 commit 9cfa197
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ export const addAllowedMarkingDefinition = async (context, user, markingDefiniti
);
// add marking in max shareable markings
const groupsWithShareableMarkingToUpdate = groupsWithAutoNewMarking
.filter((g) => !g.max_shareable_markings
.find((m) => m.definition_type === markingType && m.x_opencti_order > element.x_opencti_order));
.filter((g) => !(g.max_shareable_markings ?? []).find((m) => m.definition_type === markingType && m.x_opencti_order > element.x_opencti_order));
await Promise.all(
groupsWithShareableMarkingToUpdate.map((group) => {
const currentMarkings = group.max_shareable_markings;
const finalMarkings = [
...currentMarkings.filter(({ type: t }) => t !== markingType),
...(group.max_shareable_markings ?? []).filter(({ type: t }) => t !== markingType),
...[{ type: markingType, value: markingId }],
];
return groupEditField(context, SYSTEM_USER, group.id, [{
Expand Down

0 comments on commit 9cfa197

Please sign in to comment.