diff --git a/app/Services/Workspaces/SendInvitation.php b/app/Services/Workspaces/SendInvitation.php index 78c508390..757207188 100644 --- a/app/Services/Workspaces/SendInvitation.php +++ b/app/Services/Workspaces/SendInvitation.php @@ -24,6 +24,16 @@ public function handle(Workspace $workspace, string $email): Invitation $invitation = $this->createInvitation($workspace, $email, Workspace::ROLE_MEMBER, $existingUser); + if ($existingUser) { + // If there is an existing user, we are just going to automatically accept the invitation. This avoids + // needing to support displaying workspace invitation management to users who are not part of any existing + // workspace, but also just makes sense, as it isn't likely that anyone already signed up to a SendPortal + // instance would really want to reject an invitation in the first place, so we remove friction here. + /** @var AcceptInvitation $acceptInvitation */ + $acceptInvitation = app(AcceptInvitation::class); + $acceptInvitation->handle($existingUser, $invitation); + } + $this->emailInvitation($invitation); return $invitation; diff --git a/resources/views/workspaces/emails/invitation-to-existing-user.blade.php b/resources/views/workspaces/emails/invitation-to-existing-user.blade.php index aaa2d7c01..b674cda08 100644 --- a/resources/views/workspaces/emails/invitation-to-existing-user.blade.php +++ b/resources/views/workspaces/emails/invitation-to-existing-user.blade.php @@ -1,13 +1,7 @@ -{{__('Hi!')}} +
{{__('Hi!')}}
-{{__(':userName has added you to their workspace on SendPortal!', ['userName' => $invitation->workspace->owner->name])}}
-{{__(':userName has invited you to join their workspace on SendPortal!', ['userName' => $invitation->workspace->owner->name])}} +{{__('Since you already have an account, you have automatically been added to the workspace.')}}
-{{__('See you soon!')}}
diff --git a/resources/views/workspaces/emails/invitation-to-new-user.blade.php b/resources/views/workspaces/emails/invitation-to-new-user.blade.php index a7650d55f..30f5d284a 100644 --- a/resources/views/workspaces/emails/invitation-to-new-user.blade.php +++ b/resources/views/workspaces/emails/invitation-to-new-user.blade.php @@ -1,14 +1,12 @@ -{{__('Hi!')}} +{{__('Hi!')}}
-+ {{__(':userName has invited you to join their workspace on SendPortal!', ['userName' => $invitation->workspace->owner->name])}} + {{__('If you do not already have an account, you may click the following link to get started:')}} +
-{{__(':userName has invited you to join their workspace on SendPortal!', ['userName' => $invitation->workspace->owner->name])}} -{{__('If you do not already have an account, you may click the following link to get started:')}} ++ {{ url('register?invitation='.$invitation->token) }} +
-{{__('See you soon!')}}