Skip to content
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

feature: mail provider backend #45383

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Conversation

SebastianKrupinski
Copy link
Contributor

Summary

Initial Mail Provider Implementation

TODO

  • Copyright
  • Comments
  • Minor code improvements

lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Address.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Address.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Attachment.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/IAttachment.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Dismissed Show dismissed Hide dismissed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Dismissed Show dismissed Hide dismissed
Copy link

@github-advanced-security github-advanced-security bot left a 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.

@SebastianKrupinski
Copy link
Contributor Author

TODO: Separate attachment handling for local files (saved on the system) and streamed files (generate in memory)

apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/IService.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show fixed Hide fixed
apps/theming/lib/ThemingDefaults.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/ThemingDefaults.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/Service/BackgroundService.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/ThemingDefaults.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/ImageManager.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/Settings/Personal.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/ThemingDefaults.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/Service/BackgroundService.php Dismissed Show dismissed Hide dismissed
apps/theming/lib/ImageManager.php Dismissed Show dismissed Hide dismissed
@SebastianKrupinski
Copy link
Contributor Author

TODO: unit tests

Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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!

@SebastianKrupinski SebastianKrupinski marked this pull request as ready for review June 4, 2024 17:21
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane

apps/dav/lib/CalDAV/Schedule/IMipPlugin.php Fixed Show resolved Hide resolved
lib/private/Mail/Provider/Manager.php Outdated Show resolved Hide resolved
lib/private/Mail/Provider/Manager.php Outdated Show resolved Hide resolved
lib/public/Mail/Provider/IMessageSend.php Outdated Show resolved Hide resolved
lib/private/Mail/Provider/Manager.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
lib/public/Mail/Provider/Message.php Fixed Show fixed Hide fixed
tests/lib/Mail/Provider/ManagerTest.php Outdated Show resolved Hide resolved
tests/lib/Mail/Provider/ManagerTest.php Outdated Show resolved Hide resolved
tests/lib/Mail/Provider/ManagerTest.php Outdated Show resolved Hide resolved
tests/lib/Mail/Provider/ManagerTest.php Outdated Show resolved Hide resolved
tests/lib/Mail/Provider/ManagerTest.php Outdated Show resolved Hide resolved
lib/public/Mail/Provider/Message.php Outdated Show resolved Hide resolved
@kesselb
Copy link
Contributor

kesselb commented Jul 15, 2024

  • IAddress.getAddress
  • IAddress.getLabel
  • IAttachment.getName
  • IAttachment.getType
  • IAttachment.getContents
  • IMessage.getFrom
  • IMessage.getReplyTo
  • IMessage.getTo
  • IMessage.getCC
  • IMessage.getBcc
  • IMessage.getSubject
  • IMessage.getBody
  • IMessage.getBodyHtml
  • IMessage.getBodyPlain
  • IMessage.getAttachments

Each of the above methods can return null.
This should be reworked.

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?

Screenshot from 2024-07-15 12-32-09

Screenshot from 2024-07-15 12-32-27

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>TypeError</s:exception>
  <s:message>OCA\Mail\Service\Attachment\AttachmentService::addFileFromString(): Argument #4 ($fileContents) must be of type string, null given, called in /var/www/html/apps-extra/mail/lib/Provider/Command/MessageSend.php on line 47</s:message>
</d:error>

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.

@kesselb
Copy link
Contributor

kesselb commented Jul 15, 2024

  • IProvider.createService
  • IProvider.modifyService
  • IProvider.deleteService

Are unused and the implemention in https://github.com/nextcloud/mail/pull/9651/files#diff-863bf0fae4943be717ec0db9eba3ff621d28665362e192e0b6d45a2b917426f7R190-R236 does nothing and therefore should be removed.

Copy link
Member

@st3iny st3iny left a 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:

  1. Please get rid of IServiceIdentity and IServiceLocation interfaces. We can always add new interfaces once those two features are needed and ready. Currently, they seem to be unused.
  2. All methods inside IMessage that return an array or null should 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 inside IAttachment where this also applies.)

@SebastianKrupinski SebastianKrupinski force-pushed the feature/request-803 branch 2 times, most recently from c3d0b64 to f4c1801 Compare July 17, 2024 14:54
@SebastianKrupinski
Copy link
Contributor Author

@st3iny @kesselb

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.

Copy link
Contributor

@miaulalala miaulalala left a 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.

Copy link
Member

@st3iny st3iny left a 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.

@SebastianKrupinski SebastianKrupinski force-pushed the feature/request-803 branch 2 times, most recently from 91f2c96 to cf432cf Compare July 23, 2024 16:27
Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kesselb
Copy link
Contributor

kesselb commented Jul 23, 2024

I'm aware that Beta 1 is due on 2024-07-25, but we can always backport changes if necessary.

@kesselb
Copy link
Contributor

kesselb commented Jul 23, 2024

  • Sebastian and I discussed the nullable return types and agreed to keep the nullable return types.
  • We've learned that there's a need for api consumers to signal back that an entity is unprocessable and therefore will add an exception to ocp.

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski SebastianKrupinski merged commit 644d490 into master Jul 23, 2024
167 checks passed
@SebastianKrupinski SebastianKrupinski deleted the feature/request-803 branch July 23, 2024 20:46
@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Jul 24, 2024
@ChristophWurst
Copy link
Member

@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.

@susnux susnux removed the pending documentation This pull request needs an associated documentation update label Aug 23, 2024
@susnux
Copy link
Contributor

susnux commented Aug 23, 2024

Documentation was added: nextcloud/documentation#12083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calendar invites: Administrator shall choose if server's or user's email adress is used
7 participants