[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [donate/master] Added Lektor error pages for Civi mailing links



commit b4056e56f8186dbefd57c1da41a19a48ddbb5326
Author: Peter Haight <peterh@xxxxxxxxxxxxxxx>
Date:   Mon Sep 28 16:33:52 2020 -0700

    Added Lektor error pages for Civi mailing links
    
    If a user clicks on a link like an optout or unsubscribe link in a
    CiviCRM mailing and then there's some issue with the unsubscribe, we
    need to show them some errors, so we need to send them back to the
    lektor site because we aren't going to have any display pages on the
    donate site once the Lektor pages go live.
    
    Issue #48285
---
 src/CivicrmMailingController.php | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/CivicrmMailingController.php b/src/CivicrmMailingController.php
index 4d6a51c2..1f54a6ae 100644
--- a/src/CivicrmMailingController.php
+++ b/src/CivicrmMailingController.php
@@ -32,11 +32,18 @@ class CivicrmMailingController extends BaseController {
       $crmController->sendMessage('Tor\Mailing\SubscriptionChange', $messageInfo);
       $this->renderer->render($response, "{$method}.twig");
     } else {
-      $this->vars = array(
-        'errors' => $errors,
-        'langcode' => $request->getAttribute('language')
-      );
-      $this->renderer->render($response, 'error.twig', $this->vars);
+      $subscriptionErrorUrl = $this->container->get('settings')->get('civiMailingErrorUrl');
+      if ($subscriptionErrorUrl === NULL) {
+        $this->vars = array(
+          'errors' => $errors,
+          'langcode' => $request->getAttribute('language')
+        );
+        $this->renderer->render($response, 'error.twig', $this->vars);
+      } else {
+        $uri = Uri::createFromString($subscriptionErrorUrl);
+        $uri->addQueryParam('errors', json_encode($errors));
+        return $response->withRedirect($uri->toString());
+      }
     }
   }
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits