@@ -62,14 +62,15 @@ public function find($labelId) {
6262 * @param $title
6363 * @param $color
6464 * @param $boardId
65+ * @param array<string, scalar> $customSettings
6566 * @return \OCP\AppFramework\Db\Entity
6667 * @throws StatusException
6768 * @throws \OCA\Deck\NoPermissionException
6869 * @throws \OCP\AppFramework\Db\DoesNotExistException
6970 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
7071 * @throws BadRequestException
7172 */
72- public function create ($ title , $ color , $ boardId ) {
73+ public function create ($ title , $ color , $ boardId, array $ customSettings = [] ) {
7374 $ this ->labelServiceValidator ->check (compact ('title ' , 'color ' , 'boardId ' ));
7475
7576 $ this ->permissionService ->checkPermission (null , $ boardId , Acl::PERMISSION_MANAGE );
@@ -89,6 +90,7 @@ public function create($title, $color, $boardId) {
8990 $ label ->setTitle ($ title );
9091 $ label ->setColor ($ color );
9192 $ label ->setBoardId ($ boardId );
93+ $ label ->setCustomSettingsArray ($ customSettings );
9294 $ this ->changeHelper ->boardChanged ($ boardId );
9395 return $ this ->labelMapper ->insert ($ label );
9496 }
@@ -99,7 +101,7 @@ public function cloneLabelIfNotExists(int $labelId, int $targetBoardId): Label {
99101 $ originLabel = $ this ->find ($ labelId );
100102 $ filteredValues = array_values (array_filter ($ boardLabels , fn ($ item ) => $ item ->getTitle () === $ originLabel ->getTitle ()));
101103 if (empty ($ filteredValues )) {
102- $ label = $ this ->create ($ originLabel ->getTitle (), $ originLabel ->getColor (), $ targetBoardId );
104+ $ label = $ this ->create ($ originLabel ->getTitle (), $ originLabel ->getColor (), $ targetBoardId, $ originLabel -> getCustomSettingsArray () );
103105 return $ label ;
104106 }
105107 return $ originLabel ;
@@ -130,14 +132,15 @@ public function delete($id) {
130132 * @param $id
131133 * @param $title
132134 * @param $color
135+ * @param array<string, scalar> $customSettings
133136 * @return \OCP\AppFramework\Db\Entity
134137 * @throws StatusException
135138 * @throws \OCA\Deck\NoPermissionException
136139 * @throws \OCP\AppFramework\Db\DoesNotExistException
137140 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
138141 * @throws BadRequestException
139142 */
140- public function update ($ id , $ title , $ color ) {
143+ public function update ($ id , $ title , $ color, array $ customSettings = [] ) {
141144 $ this ->labelServiceValidator ->check (compact ('title ' , 'color ' , 'id ' ));
142145
143146 $ this ->permissionService ->checkPermission ($ this ->labelMapper , $ id , Acl::PERMISSION_MANAGE );
@@ -161,6 +164,7 @@ public function update($id, $title, $color) {
161164
162165 $ label ->setTitle ($ title );
163166 $ label ->setColor ($ color );
167+ $ label ->setCustomSettingsArray ($ customSettings );
164168 $ this ->changeHelper ->boardChanged ($ label ->getBoardId ());
165169 return $ this ->labelMapper ->update ($ label );
166170 }
0 commit comments