1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Notifications: Reorgranised classes into domain specific folders

Closes #4500
This commit is contained in:
Dan Brown
2023-09-11 19:26:28 +01:00
parent 18f396c21b
commit 8e3f8de627
15 changed files with 36 additions and 33 deletions

View File

@@ -2,8 +2,8 @@
namespace BookStack\Access;
use BookStack\Access\Notifications\ConfirmEmailNotification;
use BookStack\Exceptions\ConfirmationEmailException;
use BookStack\Notifications\ConfirmEmail;
use BookStack\Users\Models\User;
class EmailConfirmationService extends UserTokenService
@@ -26,7 +26,7 @@ class EmailConfirmationService extends UserTokenService
$this->deleteByUser($user);
$token = $this->createTokenForUser($user);
$user->notify(new ConfirmEmail($token));
$user->notify(new ConfirmEmailNotification($token));
}
/**

View File

@@ -1,11 +1,12 @@
<?php
namespace BookStack\Notifications;
namespace BookStack\Access\Notifications;
use BookStack\App\MailNotification;
use BookStack\Users\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class ConfirmEmail extends MailNotification
class ConfirmEmailNotification extends MailNotification
{
public function __construct(
public string $token

View File

@@ -1,11 +1,12 @@
<?php
namespace BookStack\Notifications;
namespace BookStack\Access\Notifications;
use BookStack\App\MailNotification;
use BookStack\Users\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class ResetPassword extends MailNotification
class ResetPasswordNotification extends MailNotification
{
public function __construct(
public string $token

View File

@@ -1,11 +1,12 @@
<?php
namespace BookStack\Notifications;
namespace BookStack\Access\Notifications;
use BookStack\App\MailNotification;
use BookStack\Users\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class UserInvite extends MailNotification
class UserInviteNotification extends MailNotification
{
public function __construct(
public string $token

View File

@@ -2,7 +2,7 @@
namespace BookStack\Access;
use BookStack\Notifications\UserInvite;
use BookStack\Access\Notifications\UserInviteNotification;
use BookStack\Users\Models\User;
class UserInviteService extends UserTokenService
@@ -18,6 +18,6 @@ class UserInviteService extends UserTokenService
{
$this->deleteByUser($user);
$token = $this->createTokenForUser($user);
$user->notify(new UserInvite($token));
$user->notify(new UserInviteNotification($token));
}
}

View File

@@ -4,7 +4,7 @@ namespace BookStack\Activity\Notifications\Messages;
use BookStack\Activity\Models\Loggable;
use BookStack\Activity\Notifications\MessageParts\LinkedMailMessageLine;
use BookStack\Notifications\MailNotification;
use BookStack\App\MailNotification;
use BookStack\Users\Models\User;
use Illuminate\Bus\Queueable;

View File

@@ -1,6 +1,6 @@
<?php
namespace BookStack\Notifications;
namespace BookStack\App;
use BookStack\Users\Models\User;
use Illuminate\Bus\Queueable;

View File

@@ -5,7 +5,6 @@ namespace BookStack\Settings;
use BookStack\Activity\ActivityType;
use BookStack\Entities\Tools\TrashCan;
use BookStack\Http\Controller;
use BookStack\Notifications\TestEmail;
use BookStack\References\ReferenceStore;
use BookStack\Uploads\ImageService;
use Illuminate\Http\Request;
@@ -69,7 +68,7 @@ class MaintenanceController extends Controller
$this->logActivity(ActivityType::MAINTENANCE_ACTION_RUN, 'send-test-email');
try {
user()->notifyNow(new TestEmail());
user()->notifyNow(new TestEmailNotification());
$this->showSuccessNotification(trans('settings.maint_send_test_email_success', ['address' => user()->email]));
} catch (\Exception $exception) {
$errorMessage = trans('errors.maintenance_test_email_failure') . "\n" . $exception->getMessage();

View File

@@ -1,11 +1,12 @@
<?php
namespace BookStack\Notifications;
namespace BookStack\Settings;
use BookStack\App\MailNotification;
use BookStack\Users\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class TestEmail extends MailNotification
class TestEmailNotification extends MailNotification
{
public function toMail(User $notifiable): MailMessage
{

View File

@@ -3,6 +3,7 @@
namespace BookStack\Users\Models;
use BookStack\Access\Mfa\MfaValue;
use BookStack\Access\Notifications\ResetPasswordNotification;
use BookStack\Access\SocialAccount;
use BookStack\Activity\Models\Favourite;
use BookStack\Activity\Models\Loggable;
@@ -11,7 +12,6 @@ use BookStack\Api\ApiToken;
use BookStack\App\Model;
use BookStack\App\Sluggable;
use BookStack\Entities\Tools\SlugGenerator;
use BookStack\Notifications\ResetPassword;
use BookStack\Translation\LanguageManager;
use BookStack\Uploads\Image;
use Carbon\Carbon;
@@ -365,7 +365,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPassword($token));
$this->notify(new ResetPasswordNotification($token));
}
/**