@@ -311,7 +311,7 @@ public function createCalendarObject(int $boardId, string $owner, string $data,
311311 $ categories = $ this ->extractCategories ($ todo );
312312 if ($ categories !== null ) {
313313 $ categories = $ this ->normalizeCategoriesForLabelSync ($ boardId , $ categories , $ mode );
314- $ this ->syncCardCategories ($ card ->getId (), $ categories );
314+ $ this ->syncCardCategories ($ card ->getId (), $ categories, $ boardId );
315315 }
316316
317317 return $ card ;
@@ -418,7 +418,7 @@ private function updateCardFromCalendar(Card $sourceItem, string $data, bool $re
418418 return $ card ;
419419 }
420420 if ($ isNoopUpdate && $ categories !== null ) {
421- $ this ->syncCardCategories ($ card ->getId (), $ categories );
421+ $ this ->syncCardCategories ($ card ->getId (), $ categories, $ boardId );
422422 return $ card ;
423423 }
424424
@@ -437,7 +437,7 @@ private function updateCardFromCalendar(Card $sourceItem, string $data, bool $re
437437 $ boardId
438438 );
439439 if ($ categories !== null ) {
440- $ this ->syncCardCategories ($ updatedCard ->getId (), $ categories );
440+ $ this ->syncCardCategories ($ updatedCard ->getId (), $ categories, $ boardId );
441441 }
442442
443443 return $ updatedCard ;
@@ -722,9 +722,9 @@ private function extractCategories($todo): ?array {
722722 /**
723723 * @param list<string> $categories
724724 */
725- private function syncCardCategories (int $ cardId , array $ categories ): void {
725+ private function syncCardCategories (int $ cardId , array $ categories, ? int $ boardId = null ): void {
726726 $ card = $ this ->cardService ->find ($ cardId );
727- $ boardId = $ this ->getBoardIdForCard ($ card );
727+ $ boardId ?? = $ this ->getBoardIdForCard ($ card );
728728 $ board = $ this ->boardMapper ->find ($ boardId , true , false );
729729 $ canCreateLabels = $ this ->checkBoardPermission ($ boardId , Acl::PERMISSION_MANAGE );
730730 $ boardLabels = $ board ->getLabels () ?? [];
0 commit comments