Problem/Motivation

Regression from #3325167: Revisit the redirect to 'add block' form in the 'add block content' form

In Drupal 10.1, editing a block by default goes back to the collection.

On Drupal 10.2, it remains on that page.

This is specifically a problem when adding a translation, as that also stays on the same page, but then that results in an exception as the translation already exists.

Steps to reproduce

- On a fresh install
- Create a new block and save it (redirects to the blocks overview),
- Edit the block via directly navigating to the url (i.e do not click Edit from the overview as that will include a destination parameter
- Save the block again

Expected: Redirect to the overview page
Actual: Stay on the edit page

Proposed resolution

Fix the code to go back to overview on edit as well, not just for a new block

Remaining tasks

Create MR.

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#17 3412283-1.patch5.22 KBbingol@ciandt.com

Issue fork drupal-3412283

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Berdir created an issue. See original summary.

bramdriesen’s picture

mathilde_dumond made their first commit to this issue’s fork.

mathilde_dumond’s picture

Status: Active » Needs review

To reproduce: on a raw install, add a second language; create a new block; save it (redirects to the blocks overview), then translate it and save -> stays n the same page and complains that the translation already exists.

After the MR: when saving after the translation, we are redirected to the blocks overview page.

bramdriesen’s picture

Issue summary: View changes

Updating the IS with the steps to reproduce

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Could we get a failing test as a next step.

larowlan’s picture

but then that results in an exception as the translation already exists

Does anyone know if we have an existing issue about this behaviour? It feels like it would be better to display a message 'A translation already exists for the {language} language, you have been redirected to the edit form' and redirect

berdir’s picture

We should absolutely do that, that uncaught exception is horrible and easy to get to even without this bug (clicking on a already open and outdated translation overview page for example). Found #2745805: Do not fatal when trying to submit a content entity translation twice..

acbramley’s picture

Issue summary: View changes
acbramley’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Added tests, rebased, and fixed self-review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Test coverage can be seen in the test-only job

1) Drupal\Tests\block_content\Functional\BlockContentCreationTest::testBlockContentFormSubmitHandlers
Behat\Mink\Exception\ExpectationException: Current page is "/admin/content/block/1", but "/admin/content/block" expected.
/builds/issue/drupal-3412283/core/tests/Drupal/Tests/WebAssert.php:580
/builds/issue/drupal-3412283/core/tests/Drupal/Tests/WebAssert.php:761
/builds/issue/drupal-3412283/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php:181

Verified following the steps in the issue summary and MR did solve the issue.

  • catch committed ed23b897 on 10.2.x
    Issue #3412283 by mathilde_dumond, acbramley, Berdir, smustgrave,...

  • catch committed 42a8ae2b on 10.3.x
    Issue #3412283 by mathilde_dumond, acbramley, Berdir, smustgrave,...

  • catch committed b46fb5e6 on 11.x
    Issue #3412283 by mathilde_dumond, acbramley, Berdir, smustgrave,...
catch’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, cherry-picked to 10.3.x and 10.2.x, thanks!

bingol@ciandt.com’s picture

StatusFileSize
new5.22 KB

Status: Fixed » Closed (fixed)

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