dev/core#4674 - Add Oauth links for AdminUi MailSettings
authorcolemanw <coleman@civicrm.org>
Sat, 23 Dec 2023 15:50:09 +0000 (10:50 -0500)
committercolemanw <coleman@civicrm.org>
Tue, 2 Jan 2024 04:37:36 +0000 (23:37 -0500)
commitc0a7a4986236d838babfc1449934a550634fd657
treeb45a4f734b8f7bda9dd0e07364dc66220bda4988
parent62696c03092f07c6c2a0910b0621919546d01338
dev/core#4674 - Add Oauth links for AdminUi MailSettings

This fixes https://lab.civicrm.org/dev/core/-/issues/4674 by adding a LinksProvider
for the new GetLinks action from #27973.

It uses the CRM_Core_BAO_MailSettings::getSetupActions() function to generate the extra links,
but there is a mismatch between the two functions:

- getSetupActions() returns a fully-formed url
- API::getLinks() returns a path

However, I noticed that while in theory hook_civicrm_mailSetupActions could return various urls,
in practice they are all the same: a generic civicrm/ajax/setupMailAccount redirect.
So this returns that as the path and it works.

Perhaps we should deprecate the option to return a url from hook_civicrm_mailSetupActions
(or just remove it, since it appears to be unused & YAGNI).
ext/civi_mail/Civi/Api4/Service/Links/MailSettingsLinksProvider.php [new file with mode: 0644]