-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Ensure e-mails would always have a sender address set
- Loading branch information
1 parent
28fa6d9
commit a791189
Showing
11 changed files
with
150 additions
and
110 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/* | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2023 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
namespace humhub\components; | ||
|
||
use humhub\interfaces\MailerInterface; | ||
use yii\helpers\Url; | ||
|
||
trait ApplicationTrait | ||
{ | ||
/** | ||
* @var string|array the homepage url | ||
*/ | ||
protected $_homeUrl = null; | ||
|
||
/** | ||
* @var string Minimum PHP version that recommended to work without issues | ||
*/ | ||
public $minRecommendedPhpVersion; | ||
|
||
/** | ||
* @var string Minimum PHP version that may works but probably with small issues | ||
*/ | ||
public $minSupportedPhpVersion; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function __construct($config = []) | ||
{ | ||
// Remove obsolete config params: | ||
unset($config['components']['formatterApp']); | ||
|
||
parent::__construct($config); | ||
} | ||
|
||
/** | ||
* @return string the homepage URL | ||
*/ | ||
public function getHomeUrl(): string | ||
{ | ||
if ($this->_homeUrl === null) { | ||
return Url::to(['/dashboard/dashboard']); | ||
} | ||
|
||
if (is_array($this->_homeUrl)) { | ||
return Url::to($this->_homeUrl); | ||
} | ||
|
||
return $this->_homeUrl; | ||
} | ||
|
||
/** | ||
* @param string|array $value the homepage URL | ||
*/ | ||
public function setHomeUrl($value) | ||
{ | ||
$this->_homeUrl = $value; | ||
} | ||
|
||
public function getMailer(): MailerInterface | ||
{ | ||
return parent::getMailer(); | ||
} | ||
} |
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
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
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,13 @@ | ||
<?php | ||
|
||
/* | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2023 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
namespace humhub\interfaces; | ||
|
||
interface MailerInterface extends \yii\mail\MailerInterface | ||
{ | ||
} |
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
25 changes: 25 additions & 0 deletions
25
protected/humhub/tests/codeception/_support/TestMailer.php
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,25 @@ | ||
<?php | ||
|
||
/* | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2023 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
namespace tests\codeception\_support; | ||
|
||
use humhub\components\mail\Mailer; | ||
use humhub\interfaces\MailerInterface; | ||
|
||
/** | ||
* @since 1.15 | ||
*/ | ||
abstract class TestMailer extends \Codeception\Lib\Connector\Yii2\TestMailer implements MailerInterface | ||
{ | ||
public function compose($view = null, array $params = []) | ||
{ | ||
$message = parent::compose($view, $params); | ||
|
||
return Mailer::ensureHumHubDefaultFromValues($message); | ||
} | ||
} |
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