mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-06 02:33:48 +00:00
- share by email fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:YE2Zo20UvRL3LkRLr54PjlayHUCoDEGVICIq76iFZlU=
|
||||
APP_KEY=base64:yMMyV3sJ87ArJwlbTKlr9O2JBr/eB4w3AEKj3Z1SoPM=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_DEMO=false
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Domain\Sharing\Actions;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use Spatie\QueueableAction\QueueableAction;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Domain\Sharing\Notifications\SharedSendViaEmail;
|
||||
@@ -12,10 +13,11 @@ class SendViaEmailAction
|
||||
public function __invoke(
|
||||
array $emails,
|
||||
string $token,
|
||||
User $user,
|
||||
): void {
|
||||
foreach ($emails as $email) {
|
||||
Notification::route('mail', $email)
|
||||
->notify(new SharedSendViaEmail($token));
|
||||
->notify(new SharedSendViaEmail($token, $user));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ class ShareController extends Controller
|
||||
if ($request->has('emails')) {
|
||||
$sendLinkToEmailAction->onQueue()->execute(
|
||||
emails: $request->input('emails'),
|
||||
token: $shared->token
|
||||
token: $shared->token,
|
||||
user: $shared->user,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Domain\Sharing\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -10,8 +11,7 @@ class ShareViaEmailController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private SendViaEmailAction $sendLinkToEmailAction,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function __invoke(
|
||||
Request $request,
|
||||
@@ -20,6 +20,7 @@ class ShareViaEmailController extends Controller
|
||||
($this->sendLinkToEmailAction)->onQueue()->execute(
|
||||
emails: $request->input('emails'),
|
||||
token: $token,
|
||||
user: Auth::user(),
|
||||
);
|
||||
|
||||
return response('Done.', 204);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace Domain\Sharing\Notifications;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
@@ -12,33 +12,24 @@ class SharedSendViaEmail extends Notification
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param $token
|
||||
*/
|
||||
public function __construct($token)
|
||||
{
|
||||
$this->token = $token;
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
public function __construct(
|
||||
public string $token,
|
||||
public User $user,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
public function via(mixed $notifiable): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
public function toMail(mixed $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__t('shared_link_email_subject', ['user' => $this->user->settings->name]))
|
||||
@@ -47,16 +38,4 @@ class SharedSendViaEmail extends Notification
|
||||
->action(__t('shared_link_email_link'), url('/share', ['token' => $this->token]))
|
||||
->salutation(__t('shared_link_email_salutation', ['app_name' => get_settings('app_title') ?? 'VueFileManager']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class SetupWizardTest extends TestCase
|
||||
])
|
||||
->assertDatabaseHas('settings', [
|
||||
'name' => 'user_verification',
|
||||
'value' => 1,
|
||||
'value' => 0,
|
||||
])
|
||||
->assertDatabaseHas('settings', [
|
||||
'name' => 'app_color',
|
||||
|
||||
Reference in New Issue
Block a user