Fix user test notification.

This commit is contained in:
James Cole 2024-12-15 08:20:42 +01:00
parent 8f3cf38f77
commit ee7c4b8863
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Test; namespace FireflyIII\Notifications\Test;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable; use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
use FireflyIII\User;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification; use Illuminate\Notifications\Notification;
@ -38,20 +39,17 @@ class UserTestNotificationSlack extends Notification
{ {
use Queueable; use Queueable;
private OwnerNotifiable $owner; private User $user;
/** public function __construct(User $user)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(OwnerNotifiable $owner)
{ {
$this->owner = $owner; $this->user = $user;
} }
/** /**
* @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/ */
public function toArray(OwnerNotifiable $notifiable) public function toArray(User $user)
{ {
return [ return [
]; ];
@ -60,7 +58,7 @@ class UserTestNotificationSlack extends Notification
/** /**
* @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/ */
public function toSlack(OwnerNotifiable $notifiable) public function toSlack(User $user)
{ {
return new SlackMessage()->content((string) trans('email.admin_test_subject')); 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);
@ -69,7 +67,7 @@ class UserTestNotificationSlack extends Notification
/** /**
* @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/ */
public function via(OwnerNotifiable $notifiable) public function via(User $user)
{ {
return ['slack']; return ['slack'];
} }