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

dev/core#2141 - "Add Mail Account" - Allow hookable listing of setup links #18885

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

totten
Copy link
Member

@totten totten commented Oct 30, 2020

Overview

For certain types of mail accounts -- such as Google Mail and Microsoft Exchange Online -- the setup process may require interaction with a remote web-service. The web-service provides some critical details (like authentication tokens) and some handy details (like their username / email address).

If the site supports one of these services, then this revision will enable a setup process. It alters the "Add Mail Account" action to use a more fine-tuned procedure.

This is a part of the larger epic #18863.

Before

Screenshot from 2020-10-30 03-42-50

Steps:

  • Navigate to "Administer => CiviMail => Mail Accounts".
  • Below the table, there is a singular button "Add Mail Account".
  • Click the button.
  • It opens an empty form for configuring the account.

After

By default, the UX is the same. However, if you have an extension like oauth-client, then it changes:

Screenshot from 2020-10-30 03-44-03

Steps:

  • Navigate to "Administer => CiviMail => Mail Accounts".
  • Below the table, there is a select box for "Add Mail Account". It lists different account types.
  • Choose one of the dropdown options:
    • If you choose "Standard Mail Account", it opens the empty config form.
    • If you choose "Microsoft Exchange Online", it redirects to MS to get authorization from the user. Then, it redirects and prefills the config form.

Screenshot from 2020-10-30 03-45-03

Technical Details

This defines a new hook, hook_civicrm_mailSetupActions, e.g.

function mymod_civicrm_mailSetupActions($setupActions) {
  $setupActions['supermail'] = [
    'title' => ts('Super Mail'),
    'callback' => '_mymod_setup',
  ];
}

function _mymod_setup($setupAction) {
  return [
    'url' => '...the-next-setup-page...',
  ];
}

For standard mail accounts, 'the-next-setup-page' is just the normal/existing page. For an OAuth2-based provider like Microsoft, it is the OAuth2 URL. There is an implementation of the hook in #18863 (under ext/oauth-client) -- e.g. the oauth_client_civicrm_mailSetupActions delegates to CRM_OAuth_MailSetup and ultimately loads the mail config from ms-exchange.dist.json

Comments

In the basic/default layout, there is the "Add Mail Account" button and also a "Done" button. The "Done" button is weird. But I left it in the basic/default layout because it's hard to prove that it's weird.

…links

Overview
--------

For certain types of mail accounts -- such as Google Mail and Microsoft
Exchange Online -- the setup process may require interaction with a remote
web-service.  The web-service provides some critical details (like
authentication tokens) and some handy details (like their username / email
address).

If the supports one of these services, then this revision will enable a
setup process.  It alters the "Add Mail Account" action to use a more
fine-tuned procedure.

Before
------

* Navigate to "Administer => CiviMail => Mail Accounts".
* Below the table, there is a singular button "Add Mail Account".
* Click the button.
* It opens an empty form for configuring the account.

After
-----

By default, the UX is the same.  However, if you have an extension like
`oauth-client`, then it changes:

* Navigate to "Administer => CiviMail => Mail Accounts".
* Below the table, there is a select box for "Add Mail Account". It lists different account types.
* Choose one of the options from the dropbox. The step depends on...
    * If you choose "Standard Mail Account", it opens the empty config form.
    * If you choose "Microsoft Exchange Online", it redirects to MS to get authorization
      from the user. Then, it redirects and prefills the config form.
@civibot
Copy link

civibot bot commented Oct 30, 2020

(Standard links)

@civibot civibot bot added the master label Oct 30, 2020
@eileenmcnaughton
Copy link
Contributor

That looks really clean! It does need documentation although I'm OK merging in advance of that since there is a big documentation task in this Oauth work & I expect you will do that at the end

@eileenmcnaughton eileenmcnaughton added the merge ready PR will be merged after a few days if there are no objections label Oct 30, 2020
@totten
Copy link
Member Author

totten commented Oct 30, 2020

Agree about docs. In the exploratory branch, I'm keeping a WIP/notes commit with some backlog and draft docs, and they'll get polished more as we get closer to merging the overall patchset.

@eileenmcnaughton
Copy link
Contributor

OK - I'm going to merge this to keep it all moving. It will get another round of testing once all merged

@eileenmcnaughton eileenmcnaughton merged commit 23057ec into civicrm:master Oct 30, 2020
@totten
Copy link
Member Author

totten commented Nov 11, 2020

@totten totten deleted the master-add-mail branch November 11, 2020 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants