mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Add ability to invite users
This commit is contained in:
		| @@ -22,9 +22,11 @@ declare(strict_types=1); | ||||
|  | ||||
| namespace FireflyIII\Handlers\Events; | ||||
|  | ||||
| use FireflyIII\Events\Admin\InvitationCreated; | ||||
| use FireflyIII\Events\AdminRequestedTestMessage; | ||||
| use FireflyIII\Events\NewVersionAvailable; | ||||
| use FireflyIII\Notifications\Admin\TestNotification; | ||||
| use FireflyIII\Notifications\Admin\UserInvitation; | ||||
| use FireflyIII\Notifications\Admin\VersionCheckResult; | ||||
| use FireflyIII\Repositories\User\UserRepositoryInterface; | ||||
| use FireflyIII\Support\Facades\FireflyConfig; | ||||
| @@ -57,6 +59,27 @@ class AdminEventHandler | ||||
|         Notification::send($event->user, new TestNotification($event->user->email)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param InvitationCreated $event | ||||
|      * @return void | ||||
|      */ | ||||
|     public function sendInvitationNotification(InvitationCreated $event): void | ||||
|     { | ||||
|         $sendMail = FireflyConfig::get('notification_invite_created', true)->data; | ||||
|         if (false === $sendMail) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         /** @var UserRepositoryInterface $repository */ | ||||
|         $repository = app(UserRepositoryInterface::class); | ||||
|         $all        = $repository->all(); | ||||
|         foreach ($all as $user) { | ||||
|             if ($repository->hasRole($user, 'owner')) { | ||||
|                 Notification::send($user, new UserInvitation($event->invitee)); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Send new version message to admin. | ||||
|      * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user