FEATURE: Add hooks for email poller plugins (#21384)

While we are unable to support OAUTH2 with pop3 (due to upstream dependency ruby/net-pop#16), we are adding the support for mail pollers plugin. Doing so, it would be possible to write a plugin which then uses other ways (microsoft graph sdk for example) to poll emails from a mailbox.

The idea is that a plugin would define a class which inherits from Email::Poller and defines a poll_mailbox static method which returns an array of strings. Then the plugin could call register_mail_poller(<class_name>) to have it registered. All the configuration (oauth2 tokens, email, etc) could be managed by sitesettings defined in the plugin.
This commit is contained in:
Alessio Cosenza
2023-06-26 07:16:03 +02:00
committed by GitHub
parent 52894b9d7c
commit 56718504ac
8 changed files with 86 additions and 2 deletions

View File

@ -72,6 +72,7 @@ class DiscoursePluginRegistry
define_register :seedfu_filter, Set
define_register :demon_processes, Set
define_register :groups_callback_for_users_search_controller_action, Hash
define_register :mail_pollers, Set
define_filtered_register :staff_user_custom_fields
define_filtered_register :public_user_custom_fields
@ -119,6 +120,10 @@ class DiscoursePluginRegistry
self.auth_providers << auth_provider
end
def self.register_mail_poller(mail_poller)
self.mail_pollers << mail_poller
end
def register_js(filename, options = {})
# If we have a server side option, add that too.
self.class.javascripts << filename