mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 05:26:17 +00:00
Various code cleanup.
This commit is contained in:
@@ -43,6 +43,7 @@ class APIEventHandler
|
||||
* @param AccessTokenCreated $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function accessTokenCreated(AccessTokenCreated $event): bool
|
||||
{
|
||||
@@ -60,7 +61,7 @@ class APIEventHandler
|
||||
$ipAddress = Request::ip();
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email', null);
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class AdminEventHandler
|
||||
* @param AdminRequestedTestMessage $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function sendTestMessage(AdminRequestedTestMessage $event): bool
|
||||
{
|
||||
@@ -58,7 +59,7 @@ class AdminEventHandler
|
||||
}
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($event->user, 'remote_guard_alt_email', null);
|
||||
$pref = app('preferences')->getForUser($event->user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class AutomationHandler
|
||||
* @param RequestedReportOnJournals $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function reportJournals(RequestedReportOnJournals $event): bool
|
||||
{
|
||||
@@ -60,7 +61,7 @@ class AutomationHandler
|
||||
$email = $user->email;
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email', null);
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ class UserEventHandler
|
||||
* @param Login $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function demoUserBackToEnglish(Login $event): bool
|
||||
{
|
||||
@@ -130,6 +131,8 @@ class UserEventHandler
|
||||
|
||||
/**
|
||||
* @param DetectedNewIPAddress $event
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function notifyNewIPAddress(DetectedNewIPAddress $event): void
|
||||
{
|
||||
@@ -144,7 +147,7 @@ class UserEventHandler
|
||||
$list = app('preferences')->getForUser($user, 'login_ip_history', [])->data;
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email', null);
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
@@ -171,6 +174,7 @@ class UserEventHandler
|
||||
* @param UserChangedEmail $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function sendEmailChangeConfirmMail(UserChangedEmail $event): bool
|
||||
{
|
||||
@@ -195,6 +199,7 @@ class UserEventHandler
|
||||
* @param UserChangedEmail $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function sendEmailChangeUndoMail(UserChangedEmail $event): bool
|
||||
{
|
||||
@@ -246,6 +251,7 @@ class UserEventHandler
|
||||
* @param RegisteredUser $event
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function sendRegistrationMail(RegisteredUser $event): bool
|
||||
{
|
||||
@@ -257,7 +263,7 @@ class UserEventHandler
|
||||
$ipAddress = $event->ipAddress;
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($event->user, 'remote_guard_alt_email', null);
|
||||
$pref = app('preferences')->getForUser($event->user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
@@ -277,6 +283,7 @@ class UserEventHandler
|
||||
|
||||
/**
|
||||
* @param Login $event
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function storeUserIPAddress(Login $event): void
|
||||
{
|
||||
|
||||
@@ -42,6 +42,8 @@ class VersionCheckEventHandler
|
||||
* Checks with GitHub to see if there is a new version.
|
||||
*
|
||||
* @param RequestedVersionCheckStatus $event
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function checkForUpdates(RequestedVersionCheckStatus $event): void
|
||||
{
|
||||
@@ -59,7 +61,6 @@ class VersionCheckEventHandler
|
||||
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
/** @var User $user */
|
||||
$user = $event->user;
|
||||
if (!$repository->hasRole($user, 'owner')) {
|
||||
Log::debug('User is not admin, done.');
|
||||
@@ -87,12 +88,12 @@ class VersionCheckEventHandler
|
||||
|
||||
/**
|
||||
* @param RequestedVersionCheckStatus $event
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
protected function warnToCheckForUpdates(RequestedVersionCheckStatus $event): void
|
||||
{
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
/** @var User $user */
|
||||
$user = $event->user;
|
||||
if (!$repository->hasRole($user, 'owner')) {
|
||||
Log::debug('User is not admin, done.');
|
||||
|
||||
Reference in New Issue
Block a user