| @@ -52,9 +52,9 @@ | ||
| 52 | 52 | $requestData = [ |
| 53 | 53 | 'parent_id' => $request->getSafe('parent_id', function ($value) { |
| 54 | 54 | return (empty($value)) ? null : intval( $value); |
| 55 | 55 | }, null), |
| 56 | - 'description' => $request->getSafe('comment', 'sanitize_textarea_field'), | |
| 56 | + 'description' => $this->commentService->sanitizeContent($request->get('comment', '')), | |
| 57 | 57 | 'created_by' => get_current_user_id(), |
| 58 | 58 | 'task_id' => (int) $task_id, |
| 59 | 59 | 'type' => $request->getSafe('comment_type', 'sanitize_text_field', 'comment'), |
| 60 | 60 | 'board_id' => (int) $board_id, |
| @@ -83,19 +83,10 @@ | ||
| 83 | 83 | $rawDescription = $commentData['description']; |
| 84 | 84 | $mentionData = $this->getMentionData($request, $board_id); |
| 85 | 85 | $commentData['settings'] = [ 'raw_description' => $rawDescription, 'mentioned_id' => $mentionData ]; |
| 86 | 86 | |
| 87 | - // Ensure UTF-8 encoding for comment description | |
| 88 | - $description = mb_convert_encoding($commentData['description'], 'UTF-8', 'auto'); | |
| 87 | + $commentData['description'] = $this->commentService->renderContent($rawDescription, $mentionData); | |
| 89 | 88 | |
| 90 | - if(!empty($mentionData)) { | |
| 91 | - // Process mentions and links with UTF-8 support | |
| 92 | - $commentData['description'] = $this->commentService->processMentionAndLink($description, $mentionData); | |
| 93 | - } else { | |
| 94 | - // Process links with UTF-8 support | |
| 95 | - $commentData['description'] = $this->commentService->checkIfCommentHaveLinks($description); | |
| 96 | - } | |
| 97 | - | |
| 98 | 89 | $comment = $this->commentService->create($commentData, $task_id, $board_id); |
| 99 | 90 | if (!empty($imageIds)) { |
| 100 | 91 | $this->commentService->attachCommentImages($comment, $imageIds); |
| 101 | 92 | $comment->load(['images']); |
| @@ -138,9 +129,9 @@ | ||
| 138 | 129 | |
| 139 | 130 | public function update(Request $request, $board_id, $comment_id) |
| 140 | 131 | { |
| 141 | 132 | $requestData = [ |
| 142 | - 'description' => $request->getSafe('comment', 'sanitize_textarea_field') | |
| 133 | + 'description' => $this->commentService->sanitizeContent($request->get('comment', '')) | |
| 143 | 134 | ]; |
| 144 | 135 | |
| 145 | 136 | $validationRules = [ |
| 146 | 137 | 'description' => 'required|string' |
| @@ -209,9 +200,9 @@ | ||
| 209 | 200 | |
| 210 | 201 | public function updateReply(Request $request, $board_id, $reply_id) |
| 211 | 202 | { |
| 212 | 203 | $requestData = [ |
| 213 | - 'description' => $request->getSafe('comment', 'sanitize_textarea_field') | |
| 204 | + 'description' => $this->commentService->sanitizeContent($request->get('comment', '')) | |
| 214 | 205 | ]; |
| 215 | 206 | |
| 216 | 207 | $validationRules = [ |
| 217 | 208 | 'description' => 'required|string' |