mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-04 04:24:26 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -79,33 +79,6 @@ class UserEventHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InvitationCreated $event
|
||||
* @return void
|
||||
*/
|
||||
public function sendRegistrationInvite(InvitationCreated $event): void
|
||||
{
|
||||
$invitee = $event->invitee->email;
|
||||
$admin = $event->invitee->user->email;
|
||||
$url = route('invite', [$event->invitee->invite_code]);
|
||||
try {
|
||||
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RegisteredUser $event
|
||||
* @return bool
|
||||
*/
|
||||
public function createExchangeRates(RegisteredUser $event): void
|
||||
{
|
||||
$seeder = new ExchangeRateSeeder();
|
||||
$seeder->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires to see if a user is admin.
|
||||
*
|
||||
@@ -138,6 +111,16 @@ class UserEventHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RegisteredUser $event
|
||||
* @return bool
|
||||
*/
|
||||
public function createExchangeRates(RegisteredUser $event): void
|
||||
{
|
||||
$seeder = new ExchangeRateSeeder();
|
||||
$seeder->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RegisteredUser $event
|
||||
*
|
||||
@@ -232,6 +215,24 @@ class UserEventHandler
|
||||
app('preferences')->setForUser($user, 'login_ip_history', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RegisteredUser $event
|
||||
*/
|
||||
public function sendAdminRegistrationNotification(RegisteredUser $event): void
|
||||
{
|
||||
$sendMail = FireflyConfig::get('notification_admin_new_reg', true)->data;
|
||||
if ($sendMail) {
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$all = $repository->all();
|
||||
foreach ($all as $user) {
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
Notification::send($user, new AdminRegistrationNotification($event->user));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send email to confirm email change. Will not be made into a notification, because
|
||||
* this requires some custom fields from the user and not just the "user" object.
|
||||
@@ -289,6 +290,23 @@ class UserEventHandler
|
||||
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InvitationCreated $event
|
||||
* @return void
|
||||
*/
|
||||
public function sendRegistrationInvite(InvitationCreated $event): void
|
||||
{
|
||||
$invitee = $event->invitee->email;
|
||||
$admin = $event->invitee->user->email;
|
||||
$url = route('invite', [$event->invitee->invite_code]);
|
||||
try {
|
||||
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will send the user a registration mail, welcoming him or her to Firefly III.
|
||||
* This message is only sent when the configuration of Firefly III says so.
|
||||
@@ -304,24 +322,6 @@ class UserEventHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RegisteredUser $event
|
||||
*/
|
||||
public function sendAdminRegistrationNotification(RegisteredUser $event): void
|
||||
{
|
||||
$sendMail = FireflyConfig::get('notification_admin_new_reg', true)->data;
|
||||
if ($sendMail) {
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$all = $repository->all();
|
||||
foreach ($all as $user) {
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
Notification::send($user, new AdminRegistrationNotification($event->user));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ActuallyLoggedIn $event
|
||||
* @throws FireflyException
|
||||
|
||||
Reference in New Issue
Block a user