Poor redirect experience when editing subscriptions

Created on 16 May 2021, about 4 years ago
Updated 24 July 2024, 11 months ago

Problem/Motivation

A user without 'access commerce_subscription overview' permission will get an access denied error when saving a subscription because of the form redirect. The saved message is also grammatically incorrect.

If editing the subscription originated from the individual subscription view page's edit tab, the user should be redirected to the view page, not the overview.

If the user is redirected to the overview, lack of a changed timestamp field means the edited subscription cannot be sorted to the top by default, which is inconsistent with how Drupal admin overviews generally operate. The user loses the edited subscription.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States daniel korte Brooklyn, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand john pitcairn

    Why do we force-redirect to the overview page, when it's entirely possible that the source was not the overview page? Hard coding this in the form save() method makes a poor experience.

    The preferred workflow would be for the overview page to add a redirect parameter to its edit action links, and for the edit action on the subscription view page to redirect to the view page. Then the user will end up where they expected to be, ie where they initiated the edit.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 2 years ago
    70 pass
    • jsacksick committed 27a0bf91 on 8.x-1.x
      Issue #3214194 by Daniel Korte, John Pitcairn, jsacksick: Poor redirect...
  • Status changed to Fixed 11 months ago
  • 🇮🇱Israel jsacksick

    The order form has the following code:
    $form_state->setRedirect('entity.commerce_order.canonical', ['commerce_order' => $this->entity->id()]);

    This is what the product form does:

    if (!empty($form_state->getTriggeringElement()['#continue'])) {
          $form_state->setRedirect('entity.commerce_product_variation.collection', ['commerce_product' => $product->id()]);
        }
        else {
          $form_state->setRedirect('entity.commerce_product.canonical', ['commerce_product' => $product->id()]);
        }

    I think we should mimic what the order module is doing, I'll commit a slightly different version of the patch from #4 which doesn't attempt the redirection to the subscription collection since this is already covered by the destination parameter which is appended on the edit link.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024