From 5170bcf41a39ad8bebdace33a8997c7f0e718a0f Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 5 Nov 2017 14:24:54 -0600 Subject: [PATCH] Remove server creation notification temporarily --- app/Notifications/ServerCreated.php | 64 ----------------------------- app/Observers/ServerObserver.php | 23 ----------- 2 files changed, 87 deletions(-) delete mode 100644 app/Notifications/ServerCreated.php diff --git a/app/Notifications/ServerCreated.php b/app/Notifications/ServerCreated.php deleted file mode 100644 index b1a7b3f03..000000000 --- a/app/Notifications/ServerCreated.php +++ /dev/null @@ -1,64 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Pterodactyl\Notifications; - -use Illuminate\Bus\Queueable; -use Illuminate\Notifications\Notification; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Notifications\Messages\MailMessage; - -class ServerCreated extends Notification implements ShouldQueue -{ - use Queueable; - - /** - * @var object - */ - public $server; - - /** - * Create a new notification instance. - * - * @param array $server - */ - public function __construct(array $server) - { - $this->server = (object) $server; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array - */ - public function via($notifiable) - { - return ['mail']; - } - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail($notifiable) - { - return (new MailMessage) - ->line('A new server as been assigned to your account.') - ->line('Server Name: ' . $this->server->name) - ->line('Memory: ' . $this->server->memory . ' MB') - ->line('Node: ' . $this->server->node) - ->line('Type: ' . $this->server->service . ' - ' . $this->server->option) - ->action('Peel Off the Protective Wrap', route('server.index', $this->server->uuidShort)) - ->line('Please let us know if you have any additional questions or concerns!'); - } -} diff --git a/app/Observers/ServerObserver.php b/app/Observers/ServerObserver.php index 8ee60f61e..00db4b334 100644 --- a/app/Observers/ServerObserver.php +++ b/app/Observers/ServerObserver.php @@ -9,10 +9,8 @@ namespace Pterodactyl\Observers; -use Cache; use Pterodactyl\Events; use Pterodactyl\Models\Server; -use Pterodactyl\Notifications\ServerCreated; use Illuminate\Foundation\Bus\DispatchesJobs; class ServerObserver @@ -37,16 +35,6 @@ class ServerObserver public function created(Server $server) { event(new Events\Server\Created($server)); - - // Queue Notification Email - $server->user->notify((new ServerCreated([ - 'name' => $server->name, - 'memory' => $server->memory, - 'node' => $server->node->name, - 'service' => $server->service->name, - 'option' => $server->option->name, - 'uuidShort' => $server->uuidShort, - ]))); } /** @@ -106,17 +94,6 @@ class ServerObserver */ public function updated(Server $server) { - /* - * The cached byUuid model calls are tagged with Model:Server:byUuid: - * so that they can be accessed regardless of if there is an Auth::user() - * defined or not. - * - * We can also delete all cached byUuid items using the Model:Server tag. - */ - Cache::tags('Model:Server:byUuid:' . $server->uuid)->flush(); - Cache::tags('Model:Server:byUuid:' . $server->uuidShort)->flush(); - Cache::tags('Downloads:Server:' . $server->uuid)->flush(); - event(new Events\Server\Updated($server)); } }