Skip to content

Commit 442cc1c

Browse files
authored
Fix Blade stack requests (#375)
* Fix outdated action reference * Fix some issues in the EditCategory form request * Fix various issues in the form requests * Fix an issue in the EditCategory action * Specify vuedraggable@next in the Blade presets' required packages * Fix color inputs for the Blade presets
1 parent 28d4d0c commit 442cc1c

File tree

17 files changed

+33
-40
lines changed

17 files changed

+33
-40
lines changed

src/Actions/EditCategory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ public function __construct(Category $category, string $title, string $descripti
1616

1717
protected function transact()
1818
{
19-
return $this->category->update([
19+
$this->category->update([
2020
'title' => $this->title,
2121
'description' => $this->description,
2222
'color_light_mode' => $this->colorLightMode,
2323
'color_dark_mode' => $this->colorDarkMode,
2424
'accepts_threads' => $this->acceptsThreads,
2525
'is_private' => $this->isPrivate,
2626
]);
27+
28+
return $this->category;
2729
}
2830
}

src/Frontend/Presets/BladeBootstrapPreset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function getRequiredPackages(): array
2929
'bootstrap',
3030
'feather-icons',
3131
'vue',
32-
'vuedraggable',
32+
'vuedraggable@next',
3333
];
3434
}
3535
}

src/Frontend/Presets/BladeTailwindPreset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function getRequiredPackages(): array
3434
'feather-icons',
3535
'tailwindcss',
3636
'vue',
37-
'vuedraggable',
37+
'vuedraggable@next',
3838
];
3939
}
4040

src/Http/Requests/EditCategory.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ class EditCategory extends CreateCategory
1111
{
1212
public function fulfill()
1313
{
14+
$defaultCategoryColor = config('forum.frontend.default_category_color');
15+
1416
$input = $this->validated();
1517
$action = new Action(
1618
$this->route('category'),
17-
$input['title'] ?? null,
18-
$input['description'] ?? null,
19-
$input['color'] ?? null,
19+
$input['title'],
20+
$input['description'] ?? "",
21+
$input['color_light_mode'] ?? $defaultCategoryColor,
22+
$input['color_dark_mode'] ?? $defaultCategoryColor,
2023
$input['accepts_threads'] ?? null,
2124
$input['is_private'] ?? null
2225
);
2326
$category = $action->execute();
2427

25-
if (!$category === null) {
26-
UserEditedCategory::dispatch($this->user(), $category);
27-
}
28+
UserEditedCategory::dispatch($this->user(), $category);
2829

2930
return $category;
3031
}

src/Http/Requests/LockThread.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public function fulfill()
2626
$action = new Action($this->route('thread'));
2727
$thread = $action->execute();
2828

29-
if ($thread !== null) {
30-
UserLockedThread::dispatch($this->user(), $thread);
31-
}
29+
UserLockedThread::dispatch($this->user(), $thread);
3230

3331
return $thread;
3432
}

src/Http/Requests/MoveThread.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ public function fulfill()
3737
$action = new Action($thread, $destinationCategory);
3838
$thread = $action->execute();
3939

40-
if (!$thread === null) {
41-
UserMovedThread::dispatch($this->user(), $thread, $sourceCategory, $destinationCategory);
42-
}
40+
UserMovedThread::dispatch($this->user(), $thread, $sourceCategory, $destinationCategory);
4341

4442
return $thread;
4543
}

src/Http/Requests/PinThread.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public function fulfill()
2626
$action = new Action($this->route('thread'));
2727
$thread = $action->execute();
2828

29-
if ($thread !== null) {
30-
UserPinnedThread::dispatch($this->user(), $thread);
31-
}
29+
UserPinnedThread::dispatch($this->user(), $thread);
3230

3331
return $thread;
3432
}

src/Http/Requests/RestorePost.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public function fulfill()
2626
$action = new Action($this->route('post'));
2727
$post = $action->execute();
2828

29-
if ($post !== null) {
30-
UserRestoredPost::dispatch($this->user(), $post);
31-
}
29+
UserRestoredPost::dispatch($this->user(), $post);
3230

3331
return $post;
3432
}

src/Http/Requests/RestoreThread.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public function fulfill()
2626
$action = new Action($this->route('thread'));
2727
$thread = $action->execute();
2828

29-
if (!$thread === null) {
30-
UserRestoredThread::dispatch($this->user(), $thread);
31-
}
29+
UserRestoredThread::dispatch($this->user(), $thread);
3230

3331
return $thread;
3432
}

src/Http/Requests/UnlockThread.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ public function fulfill()
1414
$action = new Action($this->route('thread'));
1515
$thread = $action->execute();
1616

17-
if ($thread !== null) {
18-
UserUnlockedThread::dispatch($this->user(), $thread);
19-
}
17+
UserUnlockedThread::dispatch($this->user(), $thread);
2018

2119
return $thread;
2220
}

0 commit comments

Comments
 (0)