From 3b06c429b1a9ae58745f96995ff1d907da90995f Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 12 Dec 2024 15:13:03 +0200 Subject: [PATCH] New callouts to be on top --- .../collaboration/collaboration/collaboration.service.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/domain/collaboration/collaboration/collaboration.service.ts b/src/domain/collaboration/collaboration/collaboration.service.ts index 3ef8da6fa..8f86700c2 100644 --- a/src/domain/collaboration/collaboration/collaboration.service.ts +++ b/src/domain/collaboration/collaboration/collaboration.service.ts @@ -420,11 +420,10 @@ export class CollaborationService { } if (!calloutData.sortOrder) { calloutData.sortOrder = - 1 + - Math.max( + Math.min( ...collaboration.callouts.map(callout => callout.sortOrder), 0 // Needed in case there are no callouts. In that case the first callout will have sortOrder = 1 - ); + ) - 1; } const reservedNameIDs =