Problem/Motivation
Translation is not deleted when following edit link from admin/content page.
Steps to reproduce
- Enable Content Translation module
- Add additional language
- Set up translation for default 'Basic page' node type (or any else)
- Create a node and add translation for it
- Visit /admin/content page
- Click on edit link for previously added node translation
- Click on "Delete translation" button
Expected result:
- User should be redirected to node delete form (/node/NID/delete)
Actual result:
- User redirected to url that set on 'destination' url query parameter
- Translation isn't removed
Proposed resolution
Convert the button into a link because essentially it does a redirect. This is an approach used by other forms providing Delete operations.
Remaining tasks
Update the change record. Write a change record for a Drupal core issue
User interface changes
API changes
Data model changes
Release notes snippet
Sorry, can't find any mentions for exact behavior, so I created this one
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | interdiff.txt | 1.16 KB | lauriii |
| #41 | 3108102-41.patch | 9.54 KB | lauriii |
| #39 | 3108102-after.png | 5.31 KB | penyaskito |
| #39 | 3108102-before.png | 4.87 KB | penyaskito |
| #38 | interdiff.txt | 5.18 KB | lauriii |
Comments
Comment #2
mylies commentedand a raw patch for it
use this one carefully, because it can affect on entities that can provide some contrib\custom modules that have own ContentTranslationHandler implementation
Comment #3
mylies commentedComment #4
mylies commentedwoops
okay, lets fix the tests
Comment #5
mylies commentedtests seems to be fixed, but I leave this issue in active status - not sure that this way is correct one
Comment #7
spadxiii commentedSet it to needs review so this gets a few more views. The patch seems to work.
Comment #8
akasake commentedI saw that drupal 9 also has this problem
Comment #9
akasake commentedMy bad. Tested with the wrong version in #8
Comment #10
spadxiii commentedDid a quick re-roll of the last patch for drupal 9.1
Comment #11
spadxiii commentedShould've done a reroll for drupal 9.2 ... ah well, here it is :)
Comment #12
spadxiii commentedIt looks like I made a mistake when re-rolling the patch. Here's a working on for 9.2.x
Comment #16
akasake commented#12 rerolled to 9.3
Comment #17
ravi.shankar commentedPatch #12 doesn't need to reroll as it's getting applied cleanly on Drupal 9.3.x.
Comment #18
owilliwoI'm not able to apply patch #16 on a Drupal 9.3.9
Thought it was because of other patches applied to Drupal Core, but I've been testing to apply only this patch, and it's not applicable, even alone.
Comment #19
suresh prabhu parkala commentedA re-rolled patch against the latest 9.3.x.
Comment #23
quietone commentedStill valid on Drupal 10.1.x, standard install.
Comment #24
ameymudras commentedRe rolling for 10.1.0, couldn't generate an interdiff
Comment #25
ameymudras commentedComment #26
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #27
_pratik_Fix as per #24
thanks
Comment #30
lauriiiComment #31
lauriiiConverted the button into action link in Claro and changed to use property promotion.
Comment #32
smustgrave commentedHate to be that guy but can the IS be updated with the proposed solution.
Following the steps though I can confirm the issue and that patch #31 fixes it.
Besides the IS update should it be mentioned why
protected RequestStack $requestStackis protected when the rest aren't?Comment #33
lauriiiAdded the proposed solution to the IS.
That's because it's using PHP constructor property promotion. 😊
Comment #34
smustgrave commentedGotcha!
Comment #35
lauriiiComment #36
longwaveWe need backward compatibility on the $requestStack argument, in the case a subclass calls the parent constructor without this argument.
This is a public method so we should leave it in place and deprecate it for removal in 11.0.0.
As we only need destination here, can/should we use the redirect.destination service, instead of injecting the entire request stack?
Comment #37
longwaveComment #38
lauriiiThanks @longwave! This should address all of the feedback from #36. 🤞
Comment #39
penyaskitoScreenshots before and after. This not only fixes an issue, but it's a major UX improvement.
Comment #40
penyaskitoVerified the link points to the right change record 👍🏾
Our existing test didn't find the bug here. So should we have a new test that actually adds a redirect destination query fragment, to ensure this works?
Does this need specific claro tests?
Comment #41
lauriiiPaired with @penyaskito to add test case for #40.2.
#40.3: We don't usually add test coverage for UI enhancements.
Comment #42
penyaskitoCongrats! You earned the "I can write a test for that in 10 minutes badge!"
RTBC, thanks!
Comment #44
penyaskitoLooked pretty random to me, lauriii requeued.
Comment #45
longwave#43/#44 this is a new random fail: #3375584: [random test failure] Random failure in PathWorkspacesTest
Comment #47
longwaveSaving issue credits, and back to RTBC after some random fails.
Comment #49
longwaveCommitted and pushed c61d707ed4 to 11.x. Thanks!
Unfortunately not eligible for backport because of the addition to the ContentTranslationHandler constructor.
Comment #51
quietone commentedThe change records for this issue is the same as the deprecation message. I suggest someone add more explanation and perhaps a code example.
Comment #52
miiimoooThe patch https://git.drupalcode.org/project/drupal/commit/c61d707ed4.patch applies cleanly against 10.1
Comment #53
heddnSee everyone over in #2451693: Operations links on the translations overview page do not link to the correct route.
Comment #54
miiimoooThis should be closed since it has been committed https://git.drupalcode.org/project/drupal/-/commit/c61d707ed4 to 10.2+
Comment #55
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
Comment #56
penyaskitoAt this point I guess better to change this to Fixed. We can always update the change records, but even short they are enough as contain the direct method replacement.
Comment #58
luenemannComment #59
quietone commentedThe updates to the CR did not happen and now that 10.2 is no longer supported, I am removing the tat.