Clean up some code.

This commit is contained in:
James Cole
2024-12-14 05:45:54 +01:00
parent b930ad4da7
commit 7d8d773f8f
78 changed files with 2760 additions and 2674 deletions

View File

@@ -49,8 +49,6 @@ class TestNotificationEmail extends Notification
/**
* Get the array representation of the notification.
*
* @param OwnerNotifiable $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
@@ -73,9 +71,11 @@ class TestNotificationEmail extends Notification
public function toMail(OwnerNotifiable $notifiable)
{
$address = (string) config('firefly.site_owner');
return (new MailMessage())
->markdown('emails.admin-test', ['email' => $address])
->subject((string) trans('email.admin_test_subject'));
->subject((string) trans('email.admin_test_subject'))
;
}
/**

View File

@@ -26,13 +26,12 @@ namespace FireflyIII\Notifications\Test;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
use FireflyIII\Notifications\ReturnsSettings;
use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Ntfy\Message;
use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel;
//use Illuminate\Notifications\Slack\SlackMessage;
// use Illuminate\Notifications\Slack\SlackMessage;
/**
* Class TestNotification
@@ -66,7 +65,6 @@ class TestNotificationNtfy extends Notification
];
}
public function toNtfy(OwnerNotifiable $notifiable): Message
{
$settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
@@ -82,7 +80,7 @@ class TestNotificationNtfy extends Notification
config(['ntfy-notification-channel.authentication.password' => $settings['ntfy_pass']]);
}
$message = new Message();
$message = new Message();
$message->topic($settings['ntfy_topic']);
$message->title((string) trans('email.admin_test_subject'));
$message->body((string) trans('email.admin_test_message', ['channel' => 'ntfy']));

View File

@@ -25,17 +25,13 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Test;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
use NotificationChannels\Pushover\PushoverChannel;
use NotificationChannels\Pushover\PushoverMessage;
use Ntfy\Message;
use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel;
//use Illuminate\Notifications\Slack\SlackMessage;
// use Illuminate\Notifications\Slack\SlackMessage;
/**
* Class TestNotification
@@ -57,8 +53,6 @@ class TestNotificationPushover extends Notification
/**
* Get the array representation of the notification.
*
* @param OwnerNotifiable $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
@@ -69,16 +63,15 @@ class TestNotificationPushover extends Notification
];
}
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
{
Log::debug('Now in toPushover()');
return PushoverMessage::create((string)trans('email.admin_test_message', ['channel' => 'Pushover']))
->title((string)trans('email.admin_test_subject'));
->title((string)trans('email.admin_test_subject'))
;
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/

View File

@@ -29,7 +29,7 @@ use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
//use Illuminate\Notifications\Slack\SlackMessage;
// use Illuminate\Notifications\Slack\SlackMessage;
/**
* Class TestNotification
@@ -51,8 +51,6 @@ class TestNotificationSlack extends Notification
/**
* Get the array representation of the notification.
*
* @param OwnerNotifiable $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return array
@@ -66,15 +64,12 @@ class TestNotificationSlack extends Notification
/**
* Get the Slack representation of the notification.
*
* @param OwnerNotifiable $notifiable
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
*/
public function toSlack(OwnerNotifiable $notifiable)
{
return new SlackMessage()->content((string) trans('email.admin_test_subject'));
//return new SlackMessage()->text((string) trans('email.admin_test_subject'))->to($url);
// return new SlackMessage()->text((string) trans('email.admin_test_subject'))->to($url);
}
/**
@@ -82,8 +77,6 @@ class TestNotificationSlack extends Notification
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @param OwnerNotifiable $notifiable
*
* @return array
*/
public function via(OwnerNotifiable $notifiable)