| @@ -2,9 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace FluentCommunity\Modules\Auth\Classes; |
| 4 | 4 | |
| 5 | 5 | use FluentCommunity\App\Http\Controllers\Controller; |
| 6 | -use FluentCommunity\App\Models\BaseSpace; | |
| 7 | 6 | use FluentCommunity\App\Models\Space; |
| 8 | 7 | use FluentCommunity\App\Models\SpaceUserPivot; |
| 9 | 8 | use FluentCommunity\App\Services\Helper; |
| 10 | 9 | use FluentCommunity\App\Services\ProfileHelper; |
| @@ -155,11 +154,19 @@ | ||
| 155 | 154 | |
| 156 | 155 | public function resend(Request $request, $invitationId) |
| 157 | 156 | { |
| 158 | 157 | $invitation = Invitation::findOrFail($invitationId); |
| 158 | + /** @var Invitation $invitation */ | |
| 159 | 159 | $user = $this->getUser(true); |
| 160 | 160 | $space = Space::findOrFail($invitation->post_id); |
| 161 | 161 | $space->verifyUserPermisson($user, 'community_moderator'); |
| 162 | + | |
| 163 | + // Links have no recipient; resending would mail an empty address and burn a redemption. | |
| 164 | + if (!is_email($invitation->message)) { | |
| 165 | + return $this->sendError([ | |
| 166 | + 'message' => __('Only email invitations can be resent.', 'fluent-community') | |
| 167 | + ]); | |
| 168 | + } | |
| 162 | 169 | |
| 163 | 170 | if ($invitation->reactions_count > 5) { |
| 164 | 171 | return $this->sendError([ |
| 165 | 172 | 'message' => __('You cannot resend this invitation', 'fluent-community') |