Problem/Motivation

The query parameter destination is not set when a flag is deleted.
This makes not possible to return back to the content that has been unflagged.

Steps to reproduce

Test precondition: edit flag configuration as follow

  • Set Link Type = Field Entry Form within the Display Options
  • Set Form Behaviour = Dialog

Step to reproduce with Bookmark flag

  1. Go to the selected content
  2. Click on "Bookmark this" link to open the dialog
  3. Click the "Create flag" button to flag the content
  4. Go again to the selected content
  5. Click on "Remove bookmark" link to reopen the dialog
  6. Click the "Delete flagging" button to unflag the content
  7. In the confirmation page, click again on Delete Flagging

Expected behaviour: the flag is removed, the user is redirected back to the content page
Actual behaviour: the user stays in the unflag confirmation page because the destination param is not set

Proposed resolution

destination url param has to be properly set when the user clicks on the "Delete flagging" button.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

axel80 created an issue. See original summary.

alanhdev’s picture

Status: Active » Needs review
StatusFileSize
new589 bytes

I have just run into this issue myself and found this issue open already. It looks like the destination route parameter isn't being set properly in FlaggingForm.php. The attached patch fixes it for me.

axel80’s picture

The patch worked for me as well.
Destination parameter is now set correctly when the content is flagged or unflagged.
Thanks @AlanHDev

nejcramsak’s picture

Status: Needs review » Reviewed & tested by the community

+1 The patch worked for me also. Setting this as RTBC.

neurer’s picture

+1 Tested. Works. Please commit.

zenimagine’s picture

Thanks, I just applied the patch and it fixes the problem.

aharown07’s picture

Patch applied. Problem fixed. No other problems.
(Drupal 9.3, Flag 8.x-4.0-beta3)

bserem’s picture

Version: 8.x-4.0-beta2 » 8.x-4.x-dev

The patch works without problems.

It would be nice to include this in an upcoming release.

berdir’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

  • Berdir committed fc5bbc7 on 8.x-4.x authored by AlanHDev
    Issue #3165081 by AlanHDev: Destination URL not set when deleting flag...

Status: Fixed » Closed (fixed)

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