mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Merge branch 'master' of https://github.com/humhub/humhub
# Conflicts: # protected/humhub/modules/notification/components/MailNotificationTarget.php
This commit is contained in:
commit
9ca6719e0c
@ -13,6 +13,6 @@ It's perfect for individual:
|
||||
|
||||
More information:
|
||||
- [Homepage & Demo](http://www.humhub.org)
|
||||
- [Documentation & Class Reference](http://www.humhub.org/docs)
|
||||
- [Documentation & Class Reference](http://docs.humhub.org)
|
||||
- [Licence](http://www.humhub.org/licences)
|
||||
|
||||
|
@ -45,10 +45,12 @@ class MailNotificationTarget extends NotificationTarget
|
||||
*/
|
||||
public function handle(BaseNotification $notification, User $recipient)
|
||||
{
|
||||
Yii::$app->i18n->setUserLocale($recipient);
|
||||
|
||||
Yii::$app->view->params['showUnsubscribe'] = true;
|
||||
Yii::$app->view->params['unsubscribeUrl'] = \yii\helpers\Url::to(['/notification/user'], true);
|
||||
|
||||
// Note: the renderer is configured in common.php by default its an instance of MailNotificatoinTarget
|
||||
// Note: the renderer is configured in common.php by default its an instance of MailNotificationTarget
|
||||
$renderer = $this->getRenderer();
|
||||
|
||||
$viewParams = \yii\helpers\ArrayHelper::merge([
|
||||
@ -59,14 +61,15 @@ class MailNotificationTarget extends NotificationTarget
|
||||
'content_plaintext' => $renderer->renderText($notification)
|
||||
], $notification->getViewParams());
|
||||
|
||||
$from = $notification->originator
|
||||
? Html::encode($notification->originator->displayName).' ('.Html::encode(Yii::$app->name).')'
|
||||
: Yii::$app->settings->get('mailer.systemEmailName');
|
||||
|
||||
return Yii::$app->mailer->compose($this->view, $viewParams)
|
||||
$from = $notification->originator ? Html::encode($notification->originator->displayName) . ' (' . Html::encode(Yii::$app->name) . ')' : Yii::$app->settings->get('mailer.systemEmailName');
|
||||
|
||||
Yii::$app->mailer->compose($this->view, $viewParams)
|
||||
->setFrom([Yii::$app->settings->get('mailer.systemEmailAddress') => $from])
|
||||
->setTo($recipient->email)
|
||||
->setSubject($notification->getTitle($recipient))->send();
|
||||
|
||||
Yii::$app->i18n->autosetLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +153,7 @@ abstract class NotificationTarget extends \yii\base\Object
|
||||
* Used for handling the given $notification for multiple $users.
|
||||
*
|
||||
* @param BaseNotification $notification
|
||||
* @param type $users
|
||||
* @param User[] $users
|
||||
*/
|
||||
public function sendBulk(BaseNotification $notification, $users)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user