Update all owner events so they support all channels

This commit is contained in:
James Cole
2024-12-12 06:33:48 +01:00
parent c920070ce2
commit d995bfc081
14 changed files with 270 additions and 166 deletions

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Notifiables;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use NotificationChannels\Pushover\PushoverReceiver;
@@ -41,6 +42,7 @@ class OwnerNotifiable
public function routeNotificationForPushover()
{
Log::debug('Return settings for routeNotificationForPushover');
$pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data;
$pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;
return PushoverReceiver::withUserKey($pushoverUserToken)
@@ -59,8 +61,10 @@ class OwnerNotifiable
{
$method = 'routeNotificationFor' . Str::studly($driver);
if (method_exists($this, $method)) {
Log::debug(sprintf('Redirect for settings to "%s".', $method));
return $this->{$method}($notification); // @phpstan-ignore-line
}
Log::debug(sprintf('No method "%s" found, return generic settings.', $method));
return match ($driver) {
'mail' => (string) config('firefly.site_owner'),