Skip to content

Commit 96c293b

Browse files
authored
fix(LAR-66): Laravel notification pending articles (#157)
Co-authored-by: mckenziearts <mckenziearts@users.noreply.github.com>
1 parent aca5e45 commit 96c293b

File tree

120 files changed

+2307
-3463
lines changed

Some content is hidden

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

120 files changed

+2307
-3463
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
custom: https://laravel.cm/sponsors
2+
github: mckenziearts
23

.github/actions/setup/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI Setup
2+
description: "Sets up the environment for jobs during CI workflow"
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: 🐘 Setup PHP
8+
uses: shivammathur/setup-php@v2
9+
with:
10+
php-version: "8.2"
11+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
12+
tools: composer:v2
13+
coverage: none
14+
- name: ℹ Setup Problem Matches
15+
shell: sh
16+
run: |
17+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
18+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
19+
- name: 🗂 Get composer cache directory
20+
id: composer-cache
21+
shell: sh
22+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
23+
- name: Cache dependencies
24+
uses: actions/cache@v3
25+
with:
26+
path: ${{ steps.composer-cache.outputs.dir }}
27+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
28+
restore-keys: ${{ runner.os }}-composer-

.github/workflows/coding-standards.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/phpstan.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/quality.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Quality
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
pint:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: 👀 Checkout
19+
uses: actions/checkout@v3
20+
- name: 🪄 Setup
21+
uses: ./.github/actions/setup
22+
- name: 🔮 Install Composer Dependencies
23+
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
24+
- name: 🕵️‍♂️ Run Laravel Pint
25+
run: composer lint -- --test
26+
27+
phpstan:
28+
runs-on: ubuntu-22.04
29+
steps:
30+
- name: 👀 Checkout
31+
uses: actions/checkout@v3
32+
- name: 🪄 Setup
33+
uses: ./.github/actions/setup
34+
- name: 🔮 Install Composer Dependencies
35+
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
36+
- name: 🕵️‍♂️ Run PHPStan
37+
run: composer test:phpstan -- --ansi --no-interaction --no-progress --error-format=github
38+
39+
composer:
40+
runs-on: ubuntu-22.04
41+
steps:
42+
- name: 👀 Checkout
43+
uses: actions/checkout@v3
44+
- name: 🪄 Setup
45+
uses: ./.github/actions/setup
46+
- name: 🕵️‍♂️ Run Composer Validate
47+
run: composer validate
48+
- name: 🕵️‍♂️ Run Composer Audit
49+
run: composer audit

.github/workflows/tests.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
413

514
jobs:
6-
tests:
7-
runs-on: ubuntu-latest
15+
pest:
16+
runs-on: ubuntu-22.04
817

918
steps:
10-
- name: Checkout code
19+
- name: 👀 Checkout
1120
uses: actions/checkout@v4
12-
13-
- name: Setup PHP
14-
uses: shivammathur/setup-php@v2
15-
with:
16-
php-version: 8.2
17-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
18-
tools: composer:v2
19-
coverage: none
20-
21-
- name: Install Composer dependencies
22-
run: composer install --prefer-dist --no-interaction
23-
24-
- name: Execute tests
25-
run: composer pest
21+
- name: 🪄 Setup
22+
uses: ./.github/actions/setup
23+
- name: 🔮 Install Composer Dependencies
24+
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
25+
- name: 🧶 Install Node Dependencies
26+
run: yarn install --frozen-lockfile --no-progress
27+
- name: 🧱 Build JS Dependencies
28+
run: yarn build
29+
- name: 🕵️‍♂️ Run Pest Tests
30+
run: composer test:pest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ composer.phar
1515

1616
# Laravel Exclude
1717
#
18+
.phpunit.cache
1819
.phpunit.result.cache
1920
/public/build
2021
/public/**/filament

Makefile

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/Actions/Fortify/UpdateUserPassword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function update(User $user, array $input): void
1919
'current_password' => ['required', 'string'],
2020
'password' => $this->passwordRules(),
2121
])->after(function ($validator) use ($user, $input): void {
22-
if ( ! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) {
22+
if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) {
2323
$validator->errors()->add('current_password', __('Le mot de passe fourni ne correspond pas à votre mot de passe actuel.'));
2424
}
2525
})->validateWithBag('updatePassword');

app/Console/Commands/Cleanup/DeleteOldUnverifiedUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function handle(): void
2626

2727
if ($users->isNotEmpty()) {
2828
foreach ($users as $user) {
29-
$user->notify((new SendEMailToDeletedUser())->delay(now()->addMinutes(5)));
29+
$user->notify((new SendEMailToDeletedUser)->delay(now()->addMinutes(5)));
3030
}
3131
}
3232

app/Console/Commands/CreateAdminUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace App\Console\Commands;
66

77
use App\Models\User;
8+
use Exception;
89
use Illuminate\Console\Command;
910
use Illuminate\Database\QueryException;
1011
use Illuminate\Support\Facades\Hash;
11-
use Exception;
1212

1313
final class CreateAdminUser extends Command
1414
{

app/Console/Commands/NotifyPendingArticles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace App\Console\Commands;
66

77
use App\Models\Article;
8+
use App\Notifications\PendingArticlesNotification;
89
use Illuminate\Console\Command;
910
use Illuminate\Notifications\AnonymousNotifiable;
10-
use App\Notifications\PendingArticlesNotification;
1111

1212
final class NotifyPendingArticles extends Command
1313
{

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function schedule(Schedule $schedule): void
2323
$schedule->command('lcm:post-article-to-telegram')->everyFourHours();
2424
$schedule->command('lcm:send-unverified-mails')->weeklyOn(1, '8:00');
2525
$schedule->command('sitemap:generate')->daily();
26-
$schedule->command('lcm:notify-pending-articles')->days(2);
26+
$schedule->command('lcm:notify-pending-articles')->cron('8 0 */2 * *');
2727
}
2828
}
2929

app/Events/ApiRegistered.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ApiRegistered
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public User $user)
15-
{
16-
}
14+
public function __construct(public User $user) {}
1715
}

app/Events/ArticleWasSubmittedForApproval.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ArticleWasSubmittedForApproval
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Article $article)
15-
{
16-
}
14+
public function __construct(public Article $article) {}
1715
}

app/Events/CommentWasAdded.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@
1212
{
1313
use SerializesModels;
1414

15-
public function __construct(public Reply $reply, public Discussion $discussion)
16-
{
17-
}
15+
public function __construct(public Reply $reply, public Discussion $discussion) {}
1816
}

app/Events/EmailAddressWasChanged.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ final class EmailAddressWasChanged
1313
use Dispatchable;
1414
use SerializesModels;
1515

16-
public function __construct(public User $user)
17-
{
18-
}
16+
public function __construct(public User $user) {}
1917
}

app/Events/ReplyWasCreated.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ReplyWasCreated
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Reply $reply)
15-
{
16-
}
14+
public function __construct(public Reply $reply) {}
1715
}

app/Events/SponsoringPaymentInitialize.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class SponsoringPaymentInitialize
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Transaction $transaction)
15-
{
16-
}
14+
public function __construct(public Transaction $transaction) {}
1715
}

app/Events/ThreadWasCreated.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ThreadWasCreated
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Thread $thread)
15-
{
16-
}
14+
public function __construct(public Thread $thread) {}
1715
}

app/Filters/AbstractFilters.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ abstract class AbstractFilters
1313

1414
protected array $filters = [];
1515

16-
public function __construct(public Request $request)
17-
{
18-
}
16+
public function __construct(public Request $request) {}
1917

2018
public function filter(Builder $builder): Builder
2119
{
@@ -35,7 +33,7 @@ public function add(array $filters): self
3533

3634
public function resolverFilter(string $filter): mixed
3735
{
38-
return new $this->filters[$filter]();
36+
return new $this->filters[$filter];
3937
}
4038

4139
public function getFilters(): array

app/Filters/Thread/SortByFilter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function mappings(): array
2121

2222
/**
2323
* @param Builder<Thread> $builder
24-
* @param mixed $value
2524
* @return Builder<Thread>
2625
*/
2726
public function filter(Builder $builder, mixed $value): Builder

app/Http/Controllers/Api/Auth/ForgotPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __invoke(ForgotPasswordRequest $request): JsonResponse
1717
$request->only('email')
1818
);
1919

20-
return Password::RESET_LINK_SENT === $status
20+
return $status === Password::RESET_LINK_SENT
2121
? response()->json(['message' => __('L\'e-mail de réinitialisation du mot de passe a été envoyé avec succès !')])
2222
: response()->json(['error' => __('Un courriel ne pourrait être envoyé à cette adresse électronique !')], 401);
2323
}

app/Http/Controllers/Api/Auth/LoginController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public function login(LoginRequest $request): JsonResponse
3131
'password' => $request->input('password'),
3232
];
3333

34-
if ( ! $user || ! Auth::attempt($sanitized)) {
34+
if (! $user || ! Auth::attempt($sanitized)) {
3535
throw ValidationException::withMessages([
3636
'email' => __('Les informations d\'identification fournies sont incorrectes.'),
3737
]);
3838
}
3939

40-
if ( ! $user->tokens()) {
40+
if (! $user->tokens()) {
4141
$user->tokens()->delete();
4242
}
4343

0 commit comments

Comments
 (0)