Skip to content

Commit b17acd6

Browse files
committed
Update alert email (review)
1 parent 23c5c67 commit b17acd6

File tree

6 files changed

+24
-74
lines changed

6 files changed

+24
-74
lines changed

app/Console/Commands/Irrdb/UpdateDb.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
* http://www.gnu.org/licenses/gpl-2.0.html
2424
*/
2525

26-
use Illuminate\Database\Eloquent\Builder;
2726
use Illuminate\Support\Facades\Mail;
2827
use IXP\Console\Commands\Command;
29-
use IXP\Events\User\UserWarning as UserWarningEvent;
30-
use IXP\Mail\User\UserWarning;
28+
use IXP\Mail\Alert;
3129
use IXP\Models\Customer;
3230

3331
/**
@@ -158,9 +156,7 @@ protected function handleException( Customer $c, \Exception $e, string $type ):
158156
}
159157

160158
Mail::to( [ [ 'name' => config( 'mail.alerts_recipient.name' ), 'email' => config( 'mail.alerts_recipient.address' ) ] ] )
161-
->send( new UserWarning(
162-
new UserWarningEvent( "IRRDB {$type} update failed for {$c->name}/AS{$c->autsys}", $e->getMessage() )
163-
) );
159+
->send( new Alert("IRRDB {$type} update failed for {$c->name}/AS{$c->autsys}", $e ) );
164160

165161
$this->info( "Alert email sent to " . config( 'mail.alerts_recipient.address' ) );
166162
}

app/Events/User/UserWarning.php

-54
This file was deleted.

app/Mail/User/UserWarning.php renamed to app/Mail/Alert.php

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace IXP\Mail\User;
3+
namespace IXP\Mail;
44

55
/*
66
* Copyright (C) 2009 - 2025 Internet Neutral Exchange Association Company Limited By Guarantee.
@@ -25,30 +25,27 @@
2525
use Illuminate\Bus\Queueable;
2626
use Illuminate\Mail\Mailable;
2727
use Illuminate\Queue\SerializesModels;
28-
use IXP\Events\User\UserWarning as UserWarningEvent;
2928

3029
/**
31-
* Mailable for warning email User
30+
* Mailable for alerts
3231
*
3332
* @author Barry O'Donovan <[email protected]>
3433
* @author Laszlo Kiss <[email protected]>
3534
* @category User
36-
* @package IXP\Mail\User
37-
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
35+
* @package IXP\Mail
36+
* @copyright Copyright (C) 2009 - 2025 Internet Neutral Exchange Association Company Limited By Guarantee
3837
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
3938
*/
40-
class UserWarning extends Mailable
39+
class Alert extends Mailable
4140
{
4241
use Queueable, SerializesModels;
4342

4443
/**
4544
* Create a new message instance.
46-
*
47-
* @param UserWarningEvent $e
48-
* @return void
49-
*/
45+
**/
5046
public function __construct(
51-
public UserWarningEvent $event
47+
public string $alert,
48+
public \Exception $exception,
5249
) {}
5350

5451
/**
@@ -58,7 +55,7 @@ public function __construct(
5855
*/
5956
public function build(): self
6057
{
61-
return $this->markdown( 'user.emails.warning' )
58+
return $this->markdown( 'user.emails.alert' )
6259
->subject( config('identity.sitename' ) . " - Alert" );
6360
}
6461
}

psalm-baseline.xml

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
<code><![CDATA[public function handle(): int]]></code>
5959
</MissingDocblockType>
6060
</file>
61+
<file src="app/Console/Commands/Irrdb/UpdateDb.php">
62+
<InvalidOperand>
63+
<code><![CDATA[config( 'mail.alerts_recipient.address' )]]></code>
64+
</InvalidOperand>
65+
</file>
6166
<file src="app/Console/Commands/Irrdb/UpdatePrefixDb.php">
6267
<MissingDocblockType>
6368
<code><![CDATA[public function handle(): int]]></code>
@@ -999,6 +1004,11 @@
9991004
<code><![CDATA[$r = $am->atlasResult()]]></code>
10001005
</RedundantCondition>
10011006
</file>
1007+
<file src="app/Mail/Alert.php">
1008+
<InvalidOperand>
1009+
<code><![CDATA[config('identity.sitename' )]]></code>
1010+
</InvalidOperand>
1011+
</file>
10021012
<file src="app/Mail/Auth/ForgotPassword.php">
10031013
<InvalidOperand>
10041014
<code><![CDATA[config('identity.sitename' )]]></code>

psalm.xml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<directory name="database"/>
2323
<directory name="database/seeders"/>
2424
<ignoreFiles>
25+
<file name="psalm-baseline.xml"/>
2526
<directory name="vendor"/>
2627
</ignoreFiles>
2728
</projectFiles>

resources/views/user/emails/warning.blade.php renamed to resources/views/user/emails/alert.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## {{ config('identity.sitename') }} Alert
44

5-
{{ $event->warningTitle }}
5+
{{ $alert }}
66

77
@component('mail::panel')
8-
{{ $event->errorMessage }}
8+
{{ $exception->getMessage() }}
99
@endcomponent
1010

1111

0 commit comments

Comments
 (0)