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/Models/Comment.php +20 -0 1.402.1.0 View file →
@@ -45,8 +45,12 @@
45 45 if (empty($model->type)) {
46 46 $model->type = 'comment';
47 47 }
48 48
49 + if ($model->parent_id < 1) {
50 + $model->parent_id = Null;
51 + }
52 +
49 53 if (empty($model->privacy)) {
50 54 $model->privacy = 'private';
51 55 }
52 56
@@ -73,8 +77,18 @@
73 77 }
74 78 }
75 79 });
76 80
81 + static::deleting(function ($model) {
82 + // Delete comment/reply images and their files
83 + $images = $model->images()->get();
84 + foreach ($images as $image) {
85 + $deletedImage = clone $image;
86 + $image->delete();
87 + $model->commentImageDeleted($deletedImage, $model->board_id);
88 + }
89 + });
90 +
77 91 static::deleted(function ($model) {
78 92 if ($model->type == 'comment') {
79 93 $task = $model->task;
80 94 if ($task) {
@@ -160,7 +174,13 @@
160 174 public function images()
161 175 {
162 176 return $this->hasMany(CommentImage::class, 'object_id', 'id')
163 177 ->where('object_type', Constant::COMMENT_IMAGE);
178 + }
179 +
180 +
181 + private function commentImageDeleted($deletedImage, $boardId)
182 + {
183 + (new \FluentBoards\App\Hooks\Handlers\FileHandler())->deleteAttachmentFile($deletedImage, $boardId);
164 184 }
165 185
166 186 }