-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance calendar invitation emails #6402
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6402 +/- ##
============================================
+ Coverage 50.61% 50.64% +0.02%
- Complexity 24297 24329 +32
============================================
Files 1577 1577
Lines 92922 93047 +125
Branches 1359 1359
============================================
+ Hits 47036 47121 +85
- Misses 45886 45926 +40
|
apps/dav/appinfo/v1/caldav.php
Outdated
@@ -84,7 +84,15 @@ | |||
$server->addPlugin(new \Sabre\DAV\Sync\Plugin()); | |||
$server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); | |||
$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); | |||
$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); | |||
$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( | |||
'dav', // TODO(leon): Retrieve dynamically, but where to find it? :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickvergessen any idea on how to retrieve the current app's name from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"current" app name is dav, because this code is part of the dav app and the dav api is used by the calendar app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, I'm the one who added 'dav'
.. But how to retrieve this value dynamically? I don't want to hardcode it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this scope here you cannot retrieve this dynamically with public API and need to hard-code it. In a controller it will get injected…
|
||
private function renderMailTemplates($name, $params) { | ||
$tmplBase = 'mail/' . $name; | ||
$plainTemplate = new TemplateResponse($this->appName, $tmplBase . '-plain', $params, 'blank'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the new $mailer->createMail()->createEMailTemplate() for this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, new stuff is cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmpf, do you really prefer the new style? I don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proper link: a4deea5
return null; | ||
} | ||
|
||
private function stringOrDefault($str, $def) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use $str ?: $def
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this already in all PHP versions currently supported by NC?
EDIT:
Fix typo, sorry ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah its available since 5.3, we require 5.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you misunderstood. Drop this complete method and use ?:
directly.
No need to have a custom method which just wraps an operator?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, updated.
apps/dav/lib/Server.php
Outdated
$this->server->addPlugin(new IMipPlugin($mailer, $logger, $timezone)); | ||
$this->server->addPlugin(new IMipPlugin( | ||
'dav', // TODO(leon): Retrieve dynamically, but where to find it? :( | ||
\OC::$server->getUserSession()->getUser()->getUID(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails on anonymous users. How to properly retrieve the user id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want the owner of the event? Or which user should be returned?
Otherwise try:
$user = \OC::$server->getUserSession()->getUser();
$userId = $user instanceof IUser ? $user->getUID() : '';
apps/dav/appinfo/v1/caldav.php
Outdated
$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); | ||
$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( | ||
'dav', // TODO(leon): Retrieve dynamically, but where to find it? :( | ||
\OC::$server->getUserSession()->getUser()->getUID(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be a lot less intrusive to just dispatch an event before sending the mail in
$iTipMessage and $message as parameters. That way any app could listen for the event and update the mail contents as needed (for the changes here, that would be the calendar app with the Spreed integration).
|
Any reason why u use Swift directly? I would really like to see this use the Nextcloud 12 Email Template class. |
How would this be less intrusive? This PR is not spreed-specific, though I agree I should probably use a different wording here,
i.e.? Isn't this what Joas suggested here: #6402 (comment) |
@fancycode wouldn't this require some kind of way to load the Calendar app on requests to |
I think we should extend EMailTemplate to be able to add extensions in that case. |
Sure, but wouldn't that also be the case for apps that listen for events to extend the mail template?
|
49614be
to
71bd8bf
Compare
|
71bd8bf
to
e16f670
Compare
0c62d18
to
e16f670
Compare
hijacking this PR to fix various issues in the email |
Signed-Off-By: Leon Klingele <[email protected]> Signed-off-by: Georg Ehrke <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Georg Ehrke <[email protected]>
Signed-off-by: Georg Ehrke <[email protected]>
4214fbc
to
e111da7
Compare
please review @LukasReschke @MorrisJobke |
Let's get this in and do further tiny enhancements after feature freeze. |
This PR adds support to customize DAV-related emails on a per-attendee basis.