-
-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved sending emails to the syncer. This separates sending each indiv…
…idual mail, thus hardening the app. There are still many improvements possible in this code, eg chaining these commands, making emails just another notification type and listening to the Notify event instead. We can postpone this to a later stable release.
- Loading branch information
1 parent
4d2c078
commit e4e9282
Showing
3 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* (c) Toby Zerner <toby.zerner@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flarum\Notification\Job; | ||
|
||
use Flarum\Notification\Blueprint\BlueprintInterface; | ||
use Flarum\Notification\MailableInterface; | ||
use Flarum\Notification\NotificationMailer; | ||
use Flarum\Queue\AbstractJob; | ||
use Flarum\User\User; | ||
|
||
class SendEmailNotificationJob extends AbstractJob | ||
{ | ||
/** | ||
* @var MailableInterface | ||
*/ | ||
private $blueprint; | ||
/** | ||
* @var User | ||
*/ | ||
private $recipient; | ||
|
||
public function __construct(MailableInterface $blueprint, User $recipient) | ||
{ | ||
$this->blueprint = $blueprint; | ||
$this->recipient = $recipient; | ||
} | ||
public function handle(NotificationMailer $mailer) | ||
{ | ||
$mailer->send($this->blueprint, $this->recipient); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters