diff options
author | René Gieling <github@dartcafe.de> | 2021-05-22 18:13:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-22 18:13:16 +0300 |
commit | 56d4220d563776b0b79788c7e7843cb985e82312 (patch) | |
tree | 34cc7b9844561afb5c56f0bb70a40f34042dad1c /lib | |
parent | b845e6e51135dfa9bde2743c4ec8f6a104036cfd (diff) |
Enh/email markdown (#1631)
* Render poll description in invitations with markdown
* update makefile
* remove doctrine/orm
* psalm ignore doctrine errors
* update workflows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 3 | ||||
-rw-r--r-- | lib/Db/Poll.php | 1 | ||||
-rw-r--r-- | lib/Service/MailService.php | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 9de480ef..12a0241d 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> * * @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> + * @author René Gieling <github@dartcafe.de> * * @license GNU AGPL version 3 or any later version * @@ -47,6 +48,8 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { + include_once __DIR__ . '/../../vendor/autoload.php'; + $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); } diff --git a/lib/Db/Poll.php b/lib/Db/Poll.php index 5e2c3021..c394cb62 100644 --- a/lib/Db/Poll.php +++ b/lib/Db/Poll.php @@ -159,6 +159,7 @@ class Poll extends Entity implements JsonSerializable { /** @var int $useNo*/ protected $useNo; + public function __construct() { $this->addType('created', 'int'); diff --git a/lib/Service/MailService.php b/lib/Service/MailService.php index cb38de45..040bf8b5 100644 --- a/lib/Service/MailService.php +++ b/lib/Service/MailService.php @@ -42,6 +42,7 @@ use OCA\Polls\Db\LogMapper; use OCA\Polls\Db\Log; use OCA\Polls\Model\UserGroupClass; use OCA\Polls\Model\User; +use League\CommonMark\CommonMarkConverter; class MailService { @@ -314,9 +315,18 @@ class MailService { [$owner->getDisplayName(), $poll->getTitle()], $this->trans->t('{owner} invited you to take part in the poll "{title}"') )); - $emailTemplate->addBodyText($poll->getDescription()); + + $config = [ + 'html_input' => 'strip', + 'allow_unsafe_links' => false, + ]; + + $converter = new CommonMarkConverter($config); + + $emailTemplate->addBodyText($converter->convertToHtml($poll->getDescription()), 'Hey'); + $emailTemplate->addBodyButton( - htmlspecialchars($this->trans->t('Go to poll')), + $this->trans->t('Go to poll'), $url ); $emailTemplate->addBodyText($this->trans->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar:')); |