diff --git a/app/Console/Commands/NotifyPendingArticles.php b/app/Console/Commands/NotifyPendingArticles.php index b34572da..2caa040b 100644 --- a/app/Console/Commands/NotifyPendingArticles.php +++ b/app/Console/Commands/NotifyPendingArticles.php @@ -23,4 +23,4 @@ public function handle(AnonymousNotifiable $notifiable): void $notifiable->notify(new PendingArticlesNotification($pendingArticles)); } } -} \ No newline at end of file +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 3ee86670..a86cf296 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -31,4 +31,4 @@ protected function commands(): void { $this->load(__DIR__.'/Commands'); } -} \ No newline at end of file +} diff --git a/app/Notifications/PendingArticlesNotification.php b/app/Notifications/PendingArticlesNotification.php index 9288cd45..0f998b89 100644 --- a/app/Notifications/PendingArticlesNotification.php +++ b/app/Notifications/PendingArticlesNotification.php @@ -6,9 +6,7 @@ use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Notifications\Messages\MailMessage; use NotificationChannels\Telegram\TelegramChannel; use NotificationChannels\Telegram\TelegramMessage; @@ -16,7 +14,9 @@ final class PendingArticlesNotification extends Notification { use Queueable; - public function __construct(public Collection $pendingArticles) {} + public function __construct(public Collection $pendingArticles) + { + } public function via(mixed $notifiable): array { @@ -28,25 +28,24 @@ public function toTelegram(): TelegramMessage $message = $this->content(); return TelegramMessage::create() - ->to(config('services.telegram-bot-api.channel')) - ->content($message); + ->to(config('services.telegram-bot-api.channel'))->content($message); } private function content(): string { - $message = __("Pending approval articles:\n\n"); + $message = __("Articles soumis en attente d'approbation:\n\n"); foreach ($this->pendingArticles as $article) { $message .= __( - "[@:username](:profile_url) submitted the article [:title](:url) on: :date\n\n", [ + "[@:username](:profile_url) a soumit l'article [:title](:url) le: :date\n\n", + [ 'username' => $article->user?->username, 'profile_url' => route('profile', $article->user?->username), 'title' => $article->title, 'url' => route('articles.show', $article->slug), - 'date' => $article->submitted_at->translatedFormat('d/m/Y') + 'date' => $article->submitted_at->translatedFormat('d M Y') ] ); } - return $message; } -} \ No newline at end of file +} diff --git a/lang/en.json b/lang/en.json index 4ebcf659..9800982d 100644 --- a/lang/en.json +++ b/lang/en.json @@ -4,6 +4,7 @@ "Verify Email Address": "Verify Email Address", "Please click the button below to verify your email address.": "Please click the button below to verify your email address.", "If you did not create an account, no further action is required.": "If you did not create an account, no further action is required.", - "Pending approval articles:" : "Pending approval articles:", - "[@:username](:profile_url) submitted the article [:title](:url) on: :date" : "[@:username](:profile_url) submitted the article [:title](:url) on: :date" -} \ No newline at end of file + "Articles soumis en attente d'approbation:" : "Pending approval articles:", + "[@:username](:profile_url) a soumit l'article :title le: :date" : "[@:username](:profile_url) submitted the article :title on: :date", + "Voir l'article" : "Voir l'article" +} diff --git a/lang/fr.json b/lang/fr.json index 083b53b1..9ef90469 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -4,6 +4,7 @@ "Verify Email Address": "Vérifier l'adresse e-mail", "Please click the button below to verify your email address.": "Veuillez cliquer sur le bouton ci-dessous pour vérifier votre adresse email.", "If you did not create an account, no further action is required.": "Si vous n'avez pas créé de compte, aucune autre action n'est requise.", - "Pending approval articles:" : "Articles soumis en attente d'approbation:", - "[@:username](:profile_url) submitted the article [:title](:url) on: :date" : "[@:username](:profile_url) a soumit l'article [:title](:url) le: :date" -} \ No newline at end of file + "Articles soumis en attente d'approbation:" : "Articles soumis en attente d'approbation:", + "[@:username](:profile_url) a soumit l'article [:title](:url) le: :date" : "[@:username](:profile_url) a soumit l'article [:title](:url) le: :date", + "Voir l'article": "Voir l'article" +} diff --git a/tests/Feature/NotifyPendingArticlesTest.php b/tests/Feature/NotifyPendingArticlesTest.php index 7e260cba..3567746e 100644 --- a/tests/Feature/NotifyPendingArticlesTest.php +++ b/tests/Feature/NotifyPendingArticlesTest.php @@ -6,7 +6,7 @@ use App\Models\Article; use Illuminate\Support\Facades\Notification; -beforeEach(fn() => Notification::fake()); +beforeEach(fn () => Notification::fake()); it('will send a notification when there are pending articles', function (): void { Article::factory()->createMany([ @@ -46,4 +46,4 @@ Notification::assertNothingSent(); Notification::assertCount(0); -}); \ No newline at end of file +}); diff --git a/tests/Integration/DiscussionTest.php b/tests/Integration/DiscussionTest.php index 28bd459b..796a0df4 100644 --- a/tests/Integration/DiscussionTest.php +++ b/tests/Integration/DiscussionTest.php @@ -69,4 +69,4 @@ // When providing a slug with invalid url characters, a random 5 character string is returned. expect($discussion->slug())->toMatch('/\w{5}/'); -}); \ No newline at end of file +}); diff --git a/tests/Integration/ThreadTest.php b/tests/Integration/ThreadTest.php index 0aaefeaa..a04623b7 100644 --- a/tests/Integration/ThreadTest.php +++ b/tests/Integration/ThreadTest.php @@ -187,4 +187,4 @@ function createActiveThread(): Thread $reply->save(); return $thread; -} \ No newline at end of file +}