Skip to content

Commit 7f1368f

Browse files
fix (LAR-107) correction du fichier verify-email (#221)
Co-authored-by: Arthur Monney <[email protected]>
1 parent 7892568 commit 7f1368f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+246
-717
lines changed

app/Filament/Resources/ArticleResource.php

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Filament\Tables\Table;
1818
use Illuminate\Database\Eloquent\Builder;
1919
use Illuminate\Database\Eloquent\Collection;
20+
use Illuminate\Support\Facades\Gate;
2021

2122
final class ArticleResource extends Resource
2223
{
@@ -86,6 +87,8 @@ public static function table(Table $table): Table
8687
->requiresConfirmation()
8788
->modalIcon('heroicon-s-check')
8889
->action(function ($record): void {
90+
Gate::authorize('approve', $record);
91+
8992
$record->approved_at = now();
9093
$record->save();
9194

@@ -101,6 +104,8 @@ public static function table(Table $table): Table
101104
->requiresConfirmation()
102105
->modalIcon('heroicon-s-x-mark')
103106
->action(function ($record): void {
107+
Gate::authorize('decline', $record);
108+
104109
$record->declined_at = now();
105110
$record->save();
106111
}),

app/Http/Requests/UpdatePasswordRequest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace App\Http\Requests;
66

7-
use App\Rules\PasswordCheck;
87
use Illuminate\Foundation\Http\FormRequest;
98
use Illuminate\Validation\Rules\Password;
109

@@ -18,7 +17,7 @@ public function authorize(): bool
1817
public function rules(): array
1918
{
2019
return [
21-
'current_password' => ['sometimes', 'required', new PasswordCheck],
20+
'current_password' => ['sometimes', 'required'],
2221
'password' => ['required', 'confirmed', Password::min(8)->uncompromised()],
2322
];
2423
}

app/Livewire/Components/Forum/Reply.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function solutionAction(): Action
6363
->authorize('manage', $this->thread)
6464
->action(function (): void {
6565
if ($this->thread->isSolved()) {
66-
undoPoint(new BestReply($this->thread->solutionReply));
66+
undoPoint(new BestReply($this->thread->solutionReply)); // @phpstan-ignore-line
6767
}
6868

6969
$this->thread->markSolution($this->reply, Auth::user()); // @phpstan-ignore-line

app/Livewire/Components/Slideovers/ArticleForm.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ final class ArticleForm extends SlideOverComponent implements HasForms
3737

3838
public function mount(?int $articleId = null): void
3939
{
40-
$this->article = $articleId
40+
/** @var Article $article */
41+
$article = $articleId
4142
? Article::query()->findOrFail($articleId)
4243
: new Article;
4344

44-
$this->form->fill(array_merge($this->article->toArray(), [
45-
'is_draft' => ! $this->article->published_at,
46-
'published_at' => $this->article->published_at,
45+
$this->form->fill(array_merge($article->toArray(), [
46+
'is_draft' => ! $article->published_at,
47+
'published_at' => $article->published_at,
4748
]));
49+
50+
$this->article = $article;
4851
}
4952

5053
public static function panelMaxWidth(): string

app/Livewire/Modals/ApprovedArticle.php

-53
This file was deleted.

app/Livewire/Modals/DeleteArticle.php

-44
This file was deleted.

app/Livewire/Modals/DeleteDiscussion.php

-44
This file was deleted.

app/Livewire/Pages/Forum/Index.php

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ protected function applySearch(Builder $query): Builder
7777
protected function applySolved(Builder $query): Builder
7878
{
7979
if ($this->solved) {
80+
// @phpstan-ignore-next-line
8081
return match ($this->solved) {
8182
'no' => $query->scopes('unresolved'),
8283
'yes' => $query->scopes('resolved'),

app/Models/Reply.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function mentionedUsers(): array
8080

8181
public function to(ReplyInterface $replyable): void
8282
{
83-
$this->replyAble()->associate($replyable);
83+
$this->replyAble()->associate($replyable); // @phpstan-ignore-line
8484
}
8585

8686
public function allChildReplies(): MorphMany

app/Notifications/SendApprovedArticle.php

-33
This file was deleted.

app/Policies/ArticlePolicy.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function approve(User $user, Article $article): bool
3232
return $user->isModerator() || $user->isAdmin();
3333
}
3434

35-
public function disapprove(User $user, Article $article): bool
35+
public function decline(User $user, Article $article): bool
3636
{
3737
return $user->isModerator() || $user->isAdmin();
3838
}

app/Spotlight/Discussion.php

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function searchDiscussion(string $query): Collection
3434
return DiscussionModel::with('user')
3535
->where('title', 'like', "%{$query}%")
3636
->get()
37+
// @phpstan-ignore-next-line
3738
->map(fn (DiscussionModel $discussion) => new SpotlightSearchResult(
3839
$discussion->slug(),
3940
$discussion->title,

phpstan.neon

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ parameters:
77
level: 8
88
excludePaths:
99
- app/Http/Resources/
10-
- app/Http/Middleware/
1110
- app/Actions/
1211
- app/Notifications/
13-
- app/Http/Controllers/OAuthController.php
14-
- app/Http/Controllers/Api/Auth/LoginController.php
15-
- app/Markdown/MarkdownHelper.php
12+
# Remove this config after migrate everything to livewire
13+
- app/Http/Controllers/*
14+
- app/Markdown/*
15+
- app/Traits/HasSlug
1616
ignoreErrors:
1717
- "#^Cannot access property \\$transaction on array\\|object\\.$#"
1818
- identifier: missingType.iterableValue

resources/views/components/forum/filters.blade.php

-37
This file was deleted.

resources/views/components/forum/thread-author.blade.php

-47
This file was deleted.

0 commit comments

Comments
 (0)