From: Tim Otten Date: Wed, 10 Jan 2024 21:54:41 +0000 (-0800) Subject: (REF) civicrm/mailing/unsubscribe - Add page-controller in front of form-controller X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=944096c3dc82d1436e0c4dd98fae34a005195982;p=civicrm-core.git (REF) civicrm/mailing/unsubscribe - Add page-controller in front of form-controller Before: `civicrm/mailing/unsubscribe` points directly to `CRM_Mailing_Form_Unsubscribe` After: `civicrm/mailing/unsubscribe` points to `CRM_Mailing_Page_Unsubscribe`, which MAY delegate to `CRM_Mailing_Form_Unsubscribe` Comments: * This is a step toward supporting one-click subscribe. * The problem is that one-click unsubscribe MUST receive a POST on the same URL as a user-visible form. * In Quickform (esp `CRM_Mailing_Form_Unsubscribe`), every POST MUST give a `qfKey`. * We need a place to process the one-click POST *without* requiring `qfKey`. * There is a pre-existing class `CRM_Mailing_Page_Unsubscribe`. This was dead code. The patch co-opts/re-uses the class for its own purpose. * The old `Page` class was not referenced anywhere (by routes or other classes). * What appears to have happened: this screen was originally a `Page`; then it was renamed/converted to a `Form`; then shortly after, the original `Page` was re-imported verbatim by a gsoc student. Their commit doesn't appear to make substantive use of the `Page`. This smells like mistake in handling branches/merges/rebases. --- diff --git a/CRM/Mailing/Page/Unsubscribe.php b/CRM/Mailing/Page/Unsubscribe.php index 349ee59d2a..3db0708a20 100644 --- a/CRM/Mailing/Page/Unsubscribe.php +++ b/CRM/Mailing/Page/Unsubscribe.php @@ -14,7 +14,7 @@ * @package CRM * @copyright CiviCRM LLC https://civicrm.org/licensing */ -class CRM_Mailing_Page_Unsubscribe extends CRM_Mailing_Page_Common { +class CRM_Mailing_Page_Unsubscribe extends CRM_Core_Page { /** * Run page. @@ -25,8 +25,8 @@ class CRM_Mailing_Page_Unsubscribe extends CRM_Mailing_Page_Common { * @throws Exception */ public function run() { - $this->_type = 'unsubscribe'; - return parent::run(); + $wrapper = new CRM_Utils_Wrapper(); + return $wrapper->run('CRM_Mailing_Form_Unsubscribe', $this->_title); } } diff --git a/CRM/Mailing/xml/Menu/Mailing.xml b/CRM/Mailing/xml/Menu/Mailing.xml index f3267235d3..7942323fad 100644 --- a/CRM/Mailing/xml/Menu/Mailing.xml +++ b/CRM/Mailing/xml/Menu/Mailing.xml @@ -115,7 +115,7 @@ civicrm/mailing/unsubscribe Unsubscribe - CRM_Mailing_Form_Unsubscribe + CRM_Mailing_Page_Unsubscribe access CiviMail subscribe/unsubscribe pages true 640