-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feature: mail provider backend #45383
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
Conversation
| (($recipientName !== null) ? [$recipient => $recipientName] : [$recipient]) | ||
| ); | ||
| $message->setReplyTo( | ||
| (($senderName !== null) ? [$sender => $senderName] : [$sender]) |
Check notice
Code scanning / Psalm
RedundantConditionGivenDocblockType
| (($recipientName !== null) ? [$recipient => $recipientName] : [$recipient]) | ||
| ); | ||
| $message->setReplyTo( | ||
| (($senderName !== null) ? [$sender => $senderName] : [$sender]) |
Check notice
Code scanning / Psalm
DocblockTypeContradiction
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.
Psalm found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
|
TODO: Separate attachment handling for local files (saved on the system) and streamed files (generate in memory) |
| if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) { | ||
| return BackgroundService::DEFAULT_COLOR; | ||
| // try admin color | ||
| $defaultColor = $this->config->getAppValue(Application::APP_ID, 'primary_color', ''); |
Check notice
Code scanning / Psalm
DeprecatedMethod
| $variables['image-login-plain'] = 'false'; | ||
|
|
||
| if ($this->config->getAppValue('theming', 'color', '') !== '') { | ||
| if ($this->config->getAppValue('theming', 'primary_color', '') !== '') { |
Check notice
Code scanning / Psalm
DeprecatedMethod
| public function setDefaultBackground(): void { | ||
| $this->config->deleteUserValue($this->userId, Application::APP_ID, 'background_image'); | ||
| $this->config->deleteUserValue($this->userId, Application::APP_ID, 'background_color'); | ||
| $this->config->deleteUserValue($this->userId, Application::APP_ID, 'primary_color'); |
Check notice
Code scanning / Psalm
PossiblyNullArgument
| * Default background color only taking admin setting into account | ||
| */ | ||
| public function getDefaultColorBackground(): string { | ||
| $defaultColor = $this->config->getAppValue(Application::APP_ID, 'background_color', ''); |
Check notice
Code scanning / Psalm
DeprecatedMethod
| case 'background': | ||
| return $this->urlGenerator->linkTo(Application::APP_ID, 'img/background/' . BackgroundService::DEFAULT_BACKGROUND_IMAGE); | ||
| // Removing the background defines its mime as 'backgroundColor' | ||
| $mimeSetting = $this->config->getAppValue('theming', 'backgroundMime', ''); |
Check notice
Code scanning / Psalm
DeprecatedMethod
| /** URL of admin configured background image */ | ||
| 'backgroundImage' => $this->themingDefaults->getBackground(), | ||
| /** `backgroundColor` if disabled, mime type if defined and empty by default */ | ||
| 'backgroundMime' => $this->config->getAppValue('theming', 'backgroundMime', ''), |
Check notice
Code scanning / Psalm
DeprecatedMethod
| // If a background image is set we revert to the mean image color | ||
| if ($this->imageManager->hasImage('background')) { | ||
| $file = $this->imageManager->getImage('background'); | ||
| $returnValue = $this->backgroundService->setGlobalBackground($file->read()) ?? ''; |
Check notice
Code scanning / Psalm
PossiblyFalseArgument
| if ($handle && $image->loadFromFileHandle($handle) !== false) { | ||
| $meanColor = $this->calculateMeanColor($image); | ||
| if ($meanColor !== false) { | ||
| $this->config->setAppValue(Application::APP_ID, 'background_color', $meanColor); |
Check notice
Code scanning / Psalm
DeprecatedMethod
| imagedestroy($outputImage); | ||
| } | ||
| } catch (\Exception $e) { | ||
| if (isset($outputImage) && is_resource($outputImage) || $outputImage instanceof \GdImage) { |
Check notice
Code scanning / Psalm
PossiblyUndefinedVariable
b1b1fe5 to
2187c7c
Compare
|
TODO: unit tests |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
2ee01d0 to
43d6666
Compare
ChristophWurst
left a comment
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.
Looks sane
43d6666 to
81763fb
Compare
ff4903b to
e7d0dfc
Compare
Each of the above methods can return null. For example, IAttachment: What's the use case for having an attachment object with a name and a type but content's null, and what is the consumer supposed to do with such an object?
The requirements for the public api should be as strict as possible and can be extended when necessary. We don't have a use case for having a "null" attachment and therefore should not implement it. The same for every other method from the list above. |
Are unused and the implemention in https://github.com/nextcloud/mail/pull/9651/files#diff-863bf0fae4943be717ec0db9eba3ff621d28665362e192e0b6d45a2b917426f7R190-R236 does nothing and therefore should be removed. |
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.
The API looks solid to me and I like the design overall.
However, I agree with kesselb's latest points and have some additional minor high level feedback:
- Please get rid of
IServiceIdentityandIServiceLocationinterfaces. We can always add new interfaces once those two features are needed and ready. Currently, they seem to be unused. - All methods inside
IMessagethat return anarrayornullshould only return an (empty)array. This makes consuming the API more convenient as both cases don't need to be handled separately despite being semantically identical. (As kesselb mentioned, there are some more methods insideIAttachmentwhere this also applies.)
c3d0b64 to
f4c1801
Compare
|
I've changed the empty return type on the functions that return an array to an empty array, you have a valid point about the easier consumption of the array. I have also removed the extra IServiceIdentity and IServiceLocation interfaces and methods, even tho I have a feeling I might be adding them back in next month from a conversion I had this week, but I save the code so that should not be a big deal. |
miaulalala
left a comment
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.
Aside from the comments by Daniel and Richard this looks fine.
st3iny
left a comment
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.
Feedback has been addressed.
91f2c96 to
cf432cf
Compare
kesselb
left a comment
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'm aware that Beta 1 is due on 2024-07-25, but we can always backport changes if necessary.
|
|
cf432cf to
791149f
Compare
Signed-off-by: SebastianKrupinski <[email protected]>
791149f to
fc0b694
Compare
|
@SebastianKrupinski this PR adds new APIs to lib/public aka OCP, so we need developer docs. You can take https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/groupware/calendar.html as inspiration. |
|
Documentation was added: nextcloud/documentation#12083 |


Summary
Initial Mail Provider Implementation
TODO