mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Auto commit for release 'branch-v6.2' on 2024-12-14
This commit is contained in:
@@ -61,7 +61,8 @@ class UnknownUserLoginAttempt extends Notification
|
||||
{
|
||||
return new MailMessage()
|
||||
->markdown('emails.owner.unknown-user', ['address' => $this->address])
|
||||
->subject((string) trans('email.unknown_user_subject'));
|
||||
->subject((string) trans('email.unknown_user_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +85,8 @@ class UnknownUserLoginAttempt extends Notification
|
||||
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.unknown_user_message', ['address' => $this->address]))
|
||||
->title((string) trans('email.unknown_user_subject'));
|
||||
->title((string) trans('email.unknown_user_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -46,7 +46,6 @@ class UserInvitation extends Notification
|
||||
private InvitedUser $invitee;
|
||||
private OwnerNotifiable $owner;
|
||||
|
||||
|
||||
public function __construct(OwnerNotifiable $owner, InvitedUser $invitee)
|
||||
{
|
||||
$this->invitee = $invitee;
|
||||
@@ -69,7 +68,8 @@ class UserInvitation extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.invitation-created', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email])
|
||||
->subject((string) trans('email.invitation_created_subject'));
|
||||
->subject((string) trans('email.invitation_created_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,8 @@ class UserInvitation extends Notification
|
||||
Log::debug('Now in toPushover() for UserInvitation');
|
||||
|
||||
return PushoverMessage::create((string) trans('email.invitation_created_body', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email]))
|
||||
->title((string) trans('email.invitation_created_subject'));
|
||||
->title((string) trans('email.invitation_created_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -46,7 +46,6 @@ class UserRegistration extends Notification
|
||||
private OwnerNotifiable $owner;
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(OwnerNotifiable $owner, User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -69,7 +68,8 @@ class UserRegistration extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.registered-admin', ['email' => $this->user->email, 'id' => $this->user->id])
|
||||
->subject((string) trans('email.registered_subject_admin'));
|
||||
->subject((string) trans('email.registered_subject_admin'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,8 @@ class UserRegistration extends Notification
|
||||
Log::debug('Now in toPushover() for UserRegistration');
|
||||
|
||||
return PushoverMessage::create((string) trans('email.admin_new_user_registered', ['email' => $this->user->email, 'invitee' => $this->user->email]))
|
||||
->title((string) trans('email.registered_subject_admin'));
|
||||
->title((string) trans('email.registered_subject_admin'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -44,7 +44,6 @@ class VersionCheckResult extends Notification
|
||||
|
||||
private string $message;
|
||||
|
||||
|
||||
public function __construct(string $message)
|
||||
{
|
||||
$this->message = $message;
|
||||
@@ -66,7 +65,8 @@ class VersionCheckResult extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.new-version', ['message' => $this->message])
|
||||
->subject((string) trans('email.new_version_email_subject'));
|
||||
->subject((string) trans('email.new_version_email_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,8 @@ class VersionCheckResult extends Notification
|
||||
Log::debug('Now in toPushover() for VersionCheckResult');
|
||||
|
||||
return PushoverMessage::create($this->message)
|
||||
->title((string) trans('email.new_version_email_subject'));
|
||||
->title((string) trans('email.new_version_email_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,9 +102,10 @@ class VersionCheckResult extends Notification
|
||||
public function toSlack(OwnerNotifiable $notifiable)
|
||||
{
|
||||
return new SlackMessage()->content($this->message)
|
||||
->attachment(static function ($attachment): void {
|
||||
$attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases');
|
||||
});
|
||||
->attachment(static function ($attachment): void {
|
||||
$attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases');
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -41,7 +41,7 @@ class OwnerNotifiable
|
||||
*/
|
||||
public function routeNotificationFor($driver, $notification = null)
|
||||
{
|
||||
$method = 'routeNotificationFor' . Str::studly($driver);
|
||||
$method = 'routeNotificationFor'.Str::studly($driver);
|
||||
if (method_exists($this, $method)) {
|
||||
Log::debug(sprintf('Redirect for settings to "%s".', $method));
|
||||
|
||||
@@ -62,7 +62,8 @@ class OwnerNotifiable
|
||||
$pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;
|
||||
|
||||
return PushoverReceiver::withUserKey($pushoverUserToken)
|
||||
->withApplicationToken($pushoverAppToken);
|
||||
->withApplicationToken($pushoverAppToken)
|
||||
;
|
||||
}
|
||||
|
||||
public function routeNotificationForSlack(): string
|
||||
|
@@ -50,8 +50,8 @@ class ReturnsAvailableChannels
|
||||
private static function returnOwnerChannels(): array
|
||||
{
|
||||
|
||||
$channels = ['mail'];
|
||||
$slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;
|
||||
$channels = ['mail'];
|
||||
$slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;
|
||||
if (UrlValidator::isValidWebhookURL($slackUrl)) {
|
||||
$channels[] = 'slack';
|
||||
}
|
||||
@@ -83,8 +83,8 @@ class ReturnsAvailableChannels
|
||||
|
||||
private static function returnUserChannels(User $user): array
|
||||
{
|
||||
$channels = ['mail'];
|
||||
$slackUrl = app('preferences')->getEncryptedForUser($user, 'slack_webhook_url', '')->data;
|
||||
$channels = ['mail'];
|
||||
$slackUrl = app('preferences')->getEncryptedForUser($user, 'slack_webhook_url', '')->data;
|
||||
if (UrlValidator::isValidWebhookURL($slackUrl)) {
|
||||
$channels[] = 'slack';
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
@@ -82,7 +81,8 @@ class DisabledMFANotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.disabled_mfa_subject'));
|
||||
->title((string) trans('email.disabled_mfa_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,7 +40,6 @@ class EnabledMFANotification extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -82,7 +81,8 @@ class EnabledMFANotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.enabled_mfa_subject'));
|
||||
->title((string) trans('email.enabled_mfa_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,6 @@ class EnabledMFANotification extends Notification
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
|
@@ -93,10 +93,10 @@ class MFABackupFewLeftNotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]))
|
||||
->title((string) trans('email.mfa_few_backups_left_subject'));
|
||||
->title((string) trans('email.mfa_few_backups_left_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
|
@@ -40,7 +40,6 @@ class MFABackupNoLeftNotification extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -92,10 +91,10 @@ class MFABackupNoLeftNotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.mfa_no_backups_left_slack'));
|
||||
->title((string) trans('email.mfa_no_backups_left_slack'))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
|
@@ -47,7 +47,6 @@ class MFAManyFailedAttemptsNotification extends Notification
|
||||
$this->count = $count;
|
||||
}
|
||||
|
||||
|
||||
public function toArray(User $notifiable)
|
||||
{
|
||||
return [
|
||||
@@ -91,10 +90,10 @@ class MFAManyFailedAttemptsNotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]))
|
||||
->title((string) trans('email.mfa_many_failed_subject'));
|
||||
->title((string) trans('email.mfa_many_failed_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
|
@@ -40,7 +40,6 @@ class MFAUsedBackupCodeNotification extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -92,7 +91,8 @@ class MFAUsedBackupCodeNotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.used_backup_code_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.used_backup_code_subject'));
|
||||
->title((string) trans('email.used_backup_code_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,7 +40,6 @@ class NewBackupCodesNotification extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -92,7 +91,8 @@ class NewBackupCodesNotification extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.new_backup_codes_subject'));
|
||||
->title((string) trans('email.new_backup_codes_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* UserFailedLoginAttempt.php
|
||||
* Copyright (c) 2024 james@firefly-iii.org.
|
||||
@@ -39,13 +40,11 @@ class UserFailedLoginAttempt extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
|
||||
public function toArray(User $notifiable)
|
||||
{
|
||||
return [
|
||||
@@ -89,7 +88,8 @@ class UserFailedLoginAttempt extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.failed_login_message', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.failed_login_subject'));
|
||||
->title((string) trans('email.failed_login_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -38,7 +38,6 @@ class OwnerTestNotificationEmail extends Notification
|
||||
|
||||
private OwnerNotifiable $owner;
|
||||
|
||||
|
||||
public function __construct(OwnerNotifiable $owner)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
@@ -62,7 +61,8 @@ class OwnerTestNotificationEmail extends Notification
|
||||
|
||||
return (new MailMessage())
|
||||
->markdown('emails.admin-test', ['email' => $address])
|
||||
->subject((string) trans('email.admin_test_subject'));
|
||||
->subject((string) trans('email.admin_test_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -42,7 +42,6 @@ class OwnerTestNotificationNtfy extends Notification
|
||||
|
||||
public OwnerNotifiable $owner;
|
||||
|
||||
|
||||
public function __construct(OwnerNotifiable $owner)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
@@ -50,6 +49,8 @@ class OwnerTestNotificationNtfy extends Notification
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
|
@@ -42,7 +42,6 @@ class OwnerTestNotificationPushover extends Notification
|
||||
|
||||
private OwnerNotifiable $owner;
|
||||
|
||||
|
||||
public function __construct(OwnerNotifiable $owner)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
@@ -65,7 +64,8 @@ class OwnerTestNotificationPushover extends Notification
|
||||
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'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,7 +40,6 @@ class OwnerTestNotificationSlack extends Notification
|
||||
|
||||
private OwnerNotifiable $owner;
|
||||
|
||||
|
||||
public function __construct(OwnerNotifiable $owner)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
|
@@ -38,7 +38,6 @@ class UserTestNotificationEmail extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -53,14 +52,14 @@ class UserTestNotificationEmail extends Notification
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function toMail(User $notifiable)
|
||||
{
|
||||
$address = (string) $notifiable->email;
|
||||
|
||||
return (new MailMessage())
|
||||
->markdown('emails.admin-test', ['email' => $address])
|
||||
->subject((string) trans('email.admin_test_subject'));
|
||||
->subject((string) trans('email.admin_test_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -42,7 +42,6 @@ class UserTestNotificationNtfy extends Notification
|
||||
|
||||
public User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
@@ -42,7 +42,6 @@ class UserTestNotificationPushover extends Notification
|
||||
|
||||
private User $user;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -65,7 +64,8 @@ class UserTestNotificationPushover extends Notification
|
||||
Log::debug('Now in (user) 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'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -46,7 +46,6 @@ class BillReminder extends Notification
|
||||
private int $diff;
|
||||
private string $field;
|
||||
|
||||
|
||||
public function __construct(Bill $bill, string $field, int $diff)
|
||||
{
|
||||
$this->bill = $bill;
|
||||
@@ -54,7 +53,6 @@ class BillReminder extends Notification
|
||||
$this->diff = $diff;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
@@ -71,7 +69,8 @@ class BillReminder extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.bill-warning', ['field' => $this->field, 'diff' => $this->diff, 'bill' => $this->bill])
|
||||
->subject($this->getSubject());
|
||||
->subject($this->getSubject())
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +86,8 @@ class BillReminder extends Notification
|
||||
->attachment(static function ($attachment) use ($bill, $url): void {
|
||||
$attachment->title((string) trans('firefly.visit_bill', ['name' => $bill->name]), $url);
|
||||
})
|
||||
->content($this->getSubject());
|
||||
->content($this->getSubject())
|
||||
;
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
@@ -107,7 +107,8 @@ class BillReminder extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.bill_warning_please_action'))
|
||||
->title($this->getSubject());
|
||||
->title($this->getSubject())
|
||||
;
|
||||
}
|
||||
|
||||
private function getSubject(): string
|
||||
@@ -116,6 +117,7 @@ class BillReminder extends Notification
|
||||
if (0 === $this->diff) {
|
||||
$message = (string) trans(sprintf('email.bill_warning_subject_now_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
@@ -41,10 +41,8 @@ class NewAccessToken extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
|
||||
public function toArray(User $notifiable)
|
||||
{
|
||||
return [
|
||||
@@ -58,7 +56,8 @@ class NewAccessToken extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.token-created')
|
||||
->subject((string) trans('email.access_token_created_subject'));
|
||||
->subject((string) trans('email.access_token_created_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +85,8 @@ class NewAccessToken extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.access_token_created_body'))
|
||||
->title((string) trans('email.access_token_created_subject'));
|
||||
->title((string) trans('email.access_token_created_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -46,15 +46,14 @@ class RuleActionFailed extends Notification
|
||||
private string $ruleLink;
|
||||
private string $ruleTitle;
|
||||
|
||||
|
||||
public function __construct(array $params)
|
||||
{
|
||||
[$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink] = $params;
|
||||
$this->message = $mainMessage;
|
||||
$this->groupTitle = $groupTitle;
|
||||
$this->groupLink = $groupLink;
|
||||
$this->ruleTitle = $ruleTitle;
|
||||
$this->ruleLink = $ruleLink;
|
||||
$this->message = $mainMessage;
|
||||
$this->groupTitle = $groupTitle;
|
||||
$this->groupLink = $groupLink;
|
||||
$this->ruleTitle = $ruleTitle;
|
||||
$this->ruleLink = $ruleLink;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +82,6 @@ class RuleActionFailed extends Notification
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
@@ -108,9 +106,10 @@ class RuleActionFailed extends Notification
|
||||
public function via(User $notifiable)
|
||||
{
|
||||
$channels = ReturnsAvailableChannels::returnChannels('user', $notifiable);
|
||||
if (($key = array_search('mail', $channels)) !== false) {
|
||||
if (($key = array_search('mail', $channels, true)) !== false) {
|
||||
unset($channels[$key]);
|
||||
}
|
||||
|
||||
return $channels;
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Notifications\User;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
@@ -39,7 +38,6 @@ class TransactionCreation extends Notification
|
||||
|
||||
private array $collection;
|
||||
|
||||
|
||||
public function __construct(array $collection)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
@@ -57,15 +55,14 @@ class TransactionCreation extends Notification
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
|
||||
public function toMail(User $notifiable)
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.report-new-journals', ['transformed' => $this->collection])
|
||||
->subject(trans_choice('email.new_journals_subject', count($this->collection)));
|
||||
->subject(trans_choice('email.new_journals_subject', count($this->collection)))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
|
@@ -44,13 +44,11 @@ class UserLogin extends Notification
|
||||
|
||||
private string $ip;
|
||||
|
||||
|
||||
public function __construct(string $ip)
|
||||
{
|
||||
$this->ip = $ip;
|
||||
}
|
||||
|
||||
|
||||
public function toArray(User $notifiable)
|
||||
{
|
||||
return [
|
||||
@@ -66,7 +64,8 @@ class UserLogin extends Notification
|
||||
|
||||
return (new MailMessage())
|
||||
->markdown('emails.new-ip', ['time' => $time, 'ipAddress' => $this->ip, 'host' => $this->getHost()])
|
||||
->subject((string) trans('email.login_from_new_ip'));
|
||||
->subject((string) trans('email.login_from_new_ip'))
|
||||
;
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
@@ -86,7 +85,8 @@ class UserLogin extends Notification
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.slack_login_from_new_ip', ['host' => $this->getHost(), 'ip' => $this->ip]))
|
||||
->title((string) trans('email.login_from_new_ip'));
|
||||
->title((string) trans('email.login_from_new_ip'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,8 @@ class UserLogin extends Notification
|
||||
return ReturnsAvailableChannels::returnChannels('user', $notifiable);
|
||||
}
|
||||
|
||||
private function getHost(): string {
|
||||
private function getHost(): string
|
||||
{
|
||||
$host = '';
|
||||
|
||||
try {
|
||||
@@ -117,6 +118,7 @@ class UserLogin extends Notification
|
||||
if ($hostName !== $this->ip) {
|
||||
$host = $hostName;
|
||||
}
|
||||
|
||||
return $host;
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,6 @@ class UserNewPassword extends Notification
|
||||
|
||||
private string $url;
|
||||
|
||||
|
||||
public function __construct(string $url)
|
||||
{
|
||||
$this->url = $url;
|
||||
@@ -65,7 +64,8 @@ class UserNewPassword extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.password', ['url' => $this->url])
|
||||
->subject((string) trans('email.reset_pw_subject'));
|
||||
->subject((string) trans('email.reset_pw_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,7 +36,6 @@ class UserRegistration extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
@@ -55,7 +54,8 @@ class UserRegistration extends Notification
|
||||
{
|
||||
return (new MailMessage())
|
||||
->markdown('emails.registered', ['address' => route('index')])
|
||||
->subject((string) trans('email.registered_subject'));
|
||||
->subject((string) trans('email.registered_subject'))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user