| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentBoards\App\Http\Controllers; |
| 4 | 4 | |
| 5 | +use FluentBoards\Framework\Database\Orm\ModelNotFoundException; | |
| 5 | 6 | use FluentBoards\App\Models\Meta; |
| 6 | 7 | use FluentBoards\App\Models\Stage; |
| 7 | 8 | use FluentBoards\App\Models\Task; |
| 8 | 9 | use FluentBoards\App\Models\Board; |
| @@ -52,9 +53,9 @@ | ||
| 52 | 53 | ? 0 |
| 53 | 54 | : (int) Task::whereIn('id', $task_ids) |
| 54 | 55 | ->whereNull('archived_at') |
| 55 | 56 | ->whereNull('parent_id') |
| 56 | - ->excludeTemplateBoards() | |
| 57 | + ->onActiveAvailableBoards() | |
| 57 | 58 | ->count(); |
| 58 | 59 | |
| 59 | 60 | return [ |
| 60 | 61 | 'data' => $tasksArray, |
| @@ -439,13 +440,32 @@ | ||
| 439 | 440 | } |
| 440 | 441 | } |
| 441 | 442 | } |
| 442 | 443 | |
| 443 | - | |
| 444 | + /** | |
| 445 | + * Create a task with field-specific sanitization for its request data. | |
| 446 | + * | |
| 447 | + * @param Request $request | |
| 448 | + * @param int $board_id | |
| 449 | + * @return mixed | |
| 450 | + */ | |
| 444 | 451 | public function create(Request $request, $board_id) |
| 445 | 452 | { |
| 446 | 453 | $board_id = absint($board_id); |
| 447 | - $taskData = $this->taskSanitizeAndValidate($request->getSafe('task'), [ | |
| 454 | + $safeTaskData = $request->getSafe('task'); | |
| 455 | + $rawTaskData = $request->get('task', []); | |
| 456 | + | |
| 457 | + // Milkdown serializes pasted URLs as <https://...>, which generic text | |
| 458 | + // sanitization removes as a tag. | |
| 459 | + if ( | |
| 460 | + is_array($safeTaskData) && | |
| 461 | + is_array($rawTaskData) && | |
| 462 | + array_key_exists('description', $rawTaskData) | |
| 463 | + ) { | |
| 464 | + $safeTaskData['description'] = fluent_boards_sanitize_description($rawTaskData['description']); | |
| 465 | + } | |
| 466 | + | |
| 467 | + $taskData = $this->taskSanitizeAndValidate($safeTaskData, [ | |
| 448 | 468 | 'title' => 'required|string', |
| 449 | 469 | 'board_id' => 'required|numeric', |
| 450 | 470 | 'stage_id' => 'required|numeric', |
| 451 | 471 | 'priority' => 'nullable|string', |
| @@ -522,8 +542,10 @@ | ||
| 522 | 542 | return [ |
| 523 | 543 | 'task' => $task |
| 524 | 544 | ]; |
| 525 | 545 | |
| 546 | + } catch (ModelNotFoundException $e) { | |
| 547 | + throw $e; | |
| 526 | 548 | } catch (\Exception $e ) { |
| 527 | 549 | return $this->sendError($e->getMessage(), 400); |
| 528 | 550 | } |
| 529 | 551 | |
| @@ -735,9 +757,9 @@ | ||
| 735 | 757 | $task_id = absint($task_id); |
| 736 | 758 | //Properties in col: settings, assignees,crm_contact_id, archived_at(AUTO_SET_TIMESTAMP) , status, title, description, priority, is_watching, is_template |
| 737 | 759 | $col = $request->getSafe('property', 'sanitize_text_field'); |
| 738 | 760 | if ($col === 'description') { |
| 739 | - $value = $request->getSafe('value', 'wp_kses_post'); | |
| 761 | + $value = $request->getSafe('value', 'fluent_boards_sanitize_description'); | |
| 740 | 762 | } elseif ($col === 'settings' || $col === 'assignees') { |
| 741 | 763 | $value = $request->get('value'); |
| 742 | 764 | if (is_array($value) && isset($value['cover']) && is_array($value['cover'])) { |
| 743 | 765 | if (isset($value['cover']['backgroundColor'])) { |
| @@ -1475,9 +1497,9 @@ | ||
| 1475 | 1497 | { |
| 1476 | 1498 | $default_config = [ |
| 1477 | 1499 | [ |
| 1478 | 1500 | 'name' => 'due_today', |
| 1479 | - 'label' => __('Today', 'fluent-boards'), | |
| 1501 | + 'label' => __('Due Today', 'fluent-boards'), | |
| 1480 | 1502 | 'visible' => 'true', |
| 1481 | 1503 | 'order' => 1 |
| 1482 | 1504 | ], |
| 1483 | 1505 | [ |
| @@ -1587,9 +1609,9 @@ | ||
| 1587 | 1609 | } |
| 1588 | 1610 | |
| 1589 | 1611 | // Always apply fresh translations based on tab name |
| 1590 | 1612 | $labelMap = [ |
| 1591 | - 'due_today' => __('Today', 'fluent-boards'), | |
| 1613 | + 'due_today' => __('Due Today', 'fluent-boards'), | |
| 1592 | 1614 | 'assigned' => __('Assigned', 'fluent-boards'), |
| 1593 | 1615 | 'upcoming' => __('Upcoming', 'fluent-boards'), |
| 1594 | 1616 | 'overdue' => __('Overdue', 'fluent-boards'), |
| 1595 | 1617 | 'mentioned' => __('Mentioned', 'fluent-boards'), |