PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 2.1.0
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v2.1.0
2.1.0 2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 All 42 releases
← All changes | app/Http/Controllers/LabelController.php +12 -6 1.95.32.1.0 View file →
@@ -48,11 +48,14 @@
48 48
49 49 public function createLabel(Request $request, $board_id)
50 50 {
51 51 $board_id = absint($board_id);
52 - $labelData = $this->labelSanitizeAndValidate($request->only(['bg_color', 'color', 'label']), [
53 - 'bg_color' => 'required|string',
54 - 'color' => 'required|string',
52 + $labelData = Helper::sanitizeLabel($request->only(['bg_color', 'color', 'color_preset', 'label']));
53 + $hasPreset = !empty($labelData['color_preset']);
54 + $labelData = $this->validate($labelData, [
55 + 'bg_color' => $hasPreset ? 'nullable|string' : 'required|string',
56 + 'color' => $hasPreset ? 'nullable|string' : 'required|string',
57 + 'color_preset' => 'nullable|string',
55 58 'label' => 'nullable|string',
56 59 ]);
57 60
58 61 try {
@@ -142,11 +145,14 @@
142 145 public function editLabelofBoard(Request $request, $board_id, $label_id)
143 146 {
144 147 $board_id = absint($board_id);
145 148 $label_id = absint($label_id);
146 - $labelData = $this->labelSanitizeAndValidate($request->only(['bg_color', 'color', 'label']), [
147 - 'bg_color' => 'required|string',
148 - 'color' => 'nullable|string',
149 + $labelData = Helper::sanitizeLabel($request->only(['bg_color', 'color', 'color_preset', 'label']));
150 + $isCustomSelection = array_key_exists('color_preset', $labelData) && $labelData['color_preset'] === '';
151 + $labelData = $this->validate($labelData, [
152 + 'bg_color' => $isCustomSelection ? 'required|string' : 'nullable|string',
153 + 'color' => $isCustomSelection ? 'required|string' : 'nullable|string',
154 + 'color_preset' => 'nullable|string',
149 155 'label' => 'nullable|string',
150 156 ]);
151 157 try {
152 158 $label = $this->labelService->editLabelofBoard($labelData, $label_id, $board_id);