From 9e080d544a0de12327af115e97d20454eadd1eec Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 9 Feb 2022 13:20:57 -0500 Subject: [PATCH] Fix Discord webhook URLs --- app/Models/Flight.php | 1 + app/Notifications/Messages/Broadcast/NewsAdded.php | 3 ++- app/Notifications/Messages/Broadcast/PirepFiled.php | 3 ++- app/Notifications/Messages/Broadcast/PirepStatusChanged.php | 3 ++- app/Notifications/Messages/Broadcast/UserRegistered.php | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Models/Flight.php b/app/Models/Flight.php index a461b124..78a81cb0 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -24,6 +24,7 @@ use Illuminate\Support\Collection; * @property Collection subfleets * @property int days * @property int distance + * @property int planned_distance * @property int flight_time * @property string route * @property string dpt_time diff --git a/app/Notifications/Messages/Broadcast/NewsAdded.php b/app/Notifications/Messages/Broadcast/NewsAdded.php index 6e22296c..fd57310f 100644 --- a/app/Notifications/Messages/Broadcast/NewsAdded.php +++ b/app/Notifications/Messages/Broadcast/NewsAdded.php @@ -31,7 +31,8 @@ class NewsAdded extends Notification implements ShouldQueue public function toDiscordChannel($news): ?DiscordMessage { $dm = new DiscordMessage(); - return $dm->success() + return $dm->url(setting('notifications.discord_public_webhook_url')) + ->success() ->title('News: '.$news->subject) ->author([ 'name' => $news->user->ident.' - '.$news->user->name_private, diff --git a/app/Notifications/Messages/Broadcast/PirepFiled.php b/app/Notifications/Messages/Broadcast/PirepFiled.php index bf4afe76..ef23123c 100644 --- a/app/Notifications/Messages/Broadcast/PirepFiled.php +++ b/app/Notifications/Messages/Broadcast/PirepFiled.php @@ -64,7 +64,8 @@ class PirepFiled extends Notification implements ShouldQueue } $dm = new DiscordMessage(); - return $dm->success() + return $dm->url(setting('notifications.discord_public_webhook_url')) + ->success() ->title($title) ->description($pirep->user->discord_id ? 'Flight by <@'.$pirep->user->discord_id.'>' : '') ->url(route('frontend.pireps.show', [$pirep->id])) diff --git a/app/Notifications/Messages/Broadcast/PirepStatusChanged.php b/app/Notifications/Messages/Broadcast/PirepStatusChanged.php index 62fb36a6..ef923002 100644 --- a/app/Notifications/Messages/Broadcast/PirepStatusChanged.php +++ b/app/Notifications/Messages/Broadcast/PirepStatusChanged.php @@ -110,7 +110,8 @@ class PirepStatusChanged extends Notification implements ShouldQueue } $dm = new DiscordMessage(); - return $dm->success() + return $dm->url(setting('notifications.discord_public_webhook_url')) + ->success() ->title($title) ->description($pirep->user->discord_id ? 'Flight by <@'.$pirep->user->discord_id.'>' : '') ->url(route('frontend.pireps.show', [$pirep->id])) diff --git a/app/Notifications/Messages/Broadcast/UserRegistered.php b/app/Notifications/Messages/Broadcast/UserRegistered.php index cea0bada..840c4e6a 100644 --- a/app/Notifications/Messages/Broadcast/UserRegistered.php +++ b/app/Notifications/Messages/Broadcast/UserRegistered.php @@ -49,7 +49,8 @@ class UserRegistered extends Notification implements ShouldQueue public function toDiscordChannel($notifiable): ?DiscordMessage { $dm = new DiscordMessage(); - return $dm->success() + return $dm->url(setting('notifications.discord_private_webhook_url')) + ->success() ->title('New User Registered: '.$this->user->ident) ->author([ 'name' => $this->user->ident.' - '.$this->user->name_private,