@@ -62,14 +62,15 @@ public function find($labelId) {
62
62
* @param $title
63
63
* @param $color
64
64
* @param $boardId
65
+ * @param array<string, scalar> $customSettings
65
66
* @return \OCP\AppFramework\Db\Entity
66
67
* @throws StatusException
67
68
* @throws \OCA\Deck\NoPermissionException
68
69
* @throws \OCP\AppFramework\Db\DoesNotExistException
69
70
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
70
71
* @throws BadRequestException
71
72
*/
72
- public function create ($ title , $ color , $ boardId ) {
73
+ public function create ($ title , $ color , $ boardId, array $ customSettings = [] ) {
73
74
$ this ->labelServiceValidator ->check (compact ('title ' , 'color ' , 'boardId ' ));
74
75
75
76
$ this ->permissionService ->checkPermission (null , $ boardId , Acl::PERMISSION_MANAGE );
@@ -89,6 +90,7 @@ public function create($title, $color, $boardId) {
89
90
$ label ->setTitle ($ title );
90
91
$ label ->setColor ($ color );
91
92
$ label ->setBoardId ($ boardId );
93
+ $ label ->setCustomSettingsArray ($ customSettings );
92
94
$ this ->changeHelper ->boardChanged ($ boardId );
93
95
return $ this ->labelMapper ->insert ($ label );
94
96
}
@@ -99,7 +101,7 @@ public function cloneLabelIfNotExists(int $labelId, int $targetBoardId): Label {
99
101
$ originLabel = $ this ->find ($ labelId );
100
102
$ filteredValues = array_values (array_filter ($ boardLabels , fn ($ item ) => $ item ->getTitle () === $ originLabel ->getTitle ()));
101
103
if (empty ($ filteredValues )) {
102
- $ label = $ this ->create ($ originLabel ->getTitle (), $ originLabel ->getColor (), $ targetBoardId );
104
+ $ label = $ this ->create ($ originLabel ->getTitle (), $ originLabel ->getColor (), $ targetBoardId, $ originLabel -> getCustomSettingsArray () );
103
105
return $ label ;
104
106
}
105
107
return $ originLabel ;
@@ -130,14 +132,15 @@ public function delete($id) {
130
132
* @param $id
131
133
* @param $title
132
134
* @param $color
135
+ * @param array<string, scalar> $customSettings
133
136
* @return \OCP\AppFramework\Db\Entity
134
137
* @throws StatusException
135
138
* @throws \OCA\Deck\NoPermissionException
136
139
* @throws \OCP\AppFramework\Db\DoesNotExistException
137
140
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
138
141
* @throws BadRequestException
139
142
*/
140
- public function update ($ id , $ title , $ color ) {
143
+ public function update ($ id , $ title , $ color, array $ customSettings = [] ) {
141
144
$ this ->labelServiceValidator ->check (compact ('title ' , 'color ' , 'id ' ));
142
145
143
146
$ this ->permissionService ->checkPermission ($ this ->labelMapper , $ id , Acl::PERMISSION_MANAGE );
@@ -161,6 +164,7 @@ public function update($id, $title, $color) {
161
164
162
165
$ label ->setTitle ($ title );
163
166
$ label ->setColor ($ color );
167
+ $ label ->setCustomSettingsArray ($ customSettings );
164
168
$ this ->changeHelper ->boardChanged ($ label ->getBoardId ());
165
169
return $ this ->labelMapper ->update ($ label );
166
170
}
0 commit comments