Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix function parameter lost during redirect #42315

Merged
merged 4 commits into from
Dec 31, 2023

Conversation

janschoenherr
Copy link
Contributor

@janschoenherr janschoenherr commented Nov 7, 2023

Currently if you are switching the menu filter in the menu item select modal, the function parameter will be lost on redirect.

Summary of Changes

This PR prevents the function parameter from being omitted upon switching menus. It does that by adding the parameter to the redirect url if present.

Testing Instructions

Go to /administrator/index.php?option=com_menus&view=items&layout=modal&tmpl=component&function=myCustomFunction and switch the menu. The redirected url will have the new menutype parameter, but is missing the function parameter in the url.

Actual result BEFORE applying this Pull Request

The function parameter is missing.

Expected result AFTER applying this Pull Request

The function parameter is no longer missing.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Currently if you are switching the menu filter in the menu item select modal, the function parameter will be lost on redirect.
@brianteeman
Copy link
Contributor

image

@Fedik
Copy link
Member

Fedik commented Nov 17, 2023

The modal select for Menu in Joomla 5 does not required "function" parameter to work.
It was updated to new approach with use of postMessage() #41629

Where do you use it?

If you still need it, then please update your PR, to place it in the modal layout (form url), instead of controller.
Change here

$link = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&' . Session::getFormToken() . '=1';

To:

$link      = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&' . Session::getFormToken() . '=1&function=' . $function;

But note: use of "function" will be removed in future.

@janschoenherr
Copy link
Contributor Author

janschoenherr commented Nov 18, 2023

Thanks for the reply. Maybe I should have directed this at the 4.0 dev branch?

Anyway, it can't be moved to the modal.php. It's about the redirect in the controller. The redirect is done without the function parameter.

@Fedik
Copy link
Member

Fedik commented Nov 18, 2023

it can't be moved to the modal.php

it can, if you try what I have suggested, you will see that it works very well 😉
The function variable is very layout specific thing, I do not think it should be in controller.

Maybe I should have directed this at the 4.0 dev branch?

Yes, I think, it is a bug. For 4.4-dev branch should be okay, in theory.

@janschoenherr
Copy link
Contributor Author

If you switch the menu, the controller won't display the modal.php, because it redirects previously and ignores the function parameter.

@Fedik
Copy link
Member

Fedik commented Nov 18, 2023

Need to update URL for the form action #42315 (comment)

@janschoenherr
Copy link
Contributor Author

janschoenherr commented Nov 19, 2023

I am sorry, but have you tried adding the parameter to the form action? In the modal.php, the function parameter is already set in the hidden input field.

The POST request is being redirected in the Controller and therefore converted to a GET request, which does not have the function parameter.

@Fedik
Copy link
Member

Fedik commented Nov 19, 2023

I would not suggest you it, if it would not work

@janschoenherr
Copy link
Contributor Author

Mea culpa, you are right. I've updated the pull request. Thank you very much.

@Fedik Fedik added the bug label Nov 21, 2023
@Fedik
Copy link
Member

Fedik commented Nov 21, 2023

I have tested this item ✅ successfully on 41022b7


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42315.

1 similar comment
@fgsw
Copy link

fgsw commented Dec 1, 2023

I have tested this item ✅ successfully on 41022b7


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42315.

@Quy Quy removed the bug label Dec 1, 2023
@Quy
Copy link
Contributor

Quy commented Dec 1, 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42315.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Dec 1, 2023
@Quy Quy added the bug label Dec 1, 2023
@bembelimen bembelimen merged commit 2912ccd into joomla:5.0-dev Dec 31, 2023
2 checks passed
@bembelimen
Copy link
Contributor

Thx

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Dec 31, 2023
@bembelimen bembelimen added this to the Joomla! 5.0.2 milestone Dec 31, 2023
Razzo1987 added a commit that referenced this pull request Jan 4, 2024
* Fix link and button colors in header footer (#42504)

* [4.x] add php 8.3 to tests (#42545)

* Update the signature for #42545 (#42552)

* [4.4] Joomlaupdate remove br tag from language strings - follow up to PR 42489 (#42550)

* Better English (1)

* Better English (2)

* Remove br html element from language strings

* Fixes to form validation process (#42560)

Fixes hardening measure introduced in #23716

* [4][com_actionlogs] missed load plugin languages (#42562)

* load lang

* test-4-dupkey

* Better message on package uninstallation (#42570)

* Better message on package uninstallation when an extension from that package is missing. Fixes issue #42537 .

* backport #41865 (#42088)

* backport [5] update from nightly to latest nightly build #41865

* [5] harmonize naming task types (#42574)

* [5.0] colour contrast in media manager file list [a11y] (#42544)

* [5.0] Update phpseclib to 3.0.34 (#42469)

* Fix `function` parameter lost during redirect (#42315)

* Fix `function` parameter lost during redirect

* Move function parameter to form url

* Remove hidden input

* [4.4] Fix SQL error "1104 The SELECT would examine more than MAX_JOIN_SIZE rows" when checking for core updates (#42576)

* Use concat of columns for getting core extensions

* Fix PHPCS

* Remove wrong quotes

* Revert min version in drone (#42583)

* Joomla! 5.0.2 Release Candidate 1

* Revert to dev

* [4][com_templates] cast to int for pgsql (#42569)

* cast to int for pgsql

* yet-another

* patch article tags (#42486)

* Joomla 5.0.2 Release Candidate 2

* Reset to dev

* Update signature HMAC in .drone.yml

---------

Co-authored-by: Rick Spaan <rick@r2h.nl>
Co-authored-by: Christian Heel <66922325+heelc29@users.noreply.github.com>
Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Brian Teeman <brian@teeman.net>
Co-authored-by: George Wilson <georgejameswilson@googlemail.com>
Co-authored-by: Nicola Galgano <optimus4joomla@gmail.com>
Co-authored-by: Benjamin Trenkle <benjamin.trenkle@wicked-software.de>
Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>
Co-authored-by: David Jardin <d.jardin@djumla.de>
Co-authored-by: janschoenherr <jan@yootheme.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants