Skip to content

[6.1] Only show version history in FormView if version history is supported#47694

Open
joomdonation wants to merge 4 commits intojoomla:6.1-devfrom
joomdonation:fix_show_version_history_button
Open

[6.1] Only show version history in FormView if version history is supported#47694
joomdonation wants to merge 4 commits intojoomla:6.1-devfrom
joomdonation:fix_show_version_history_button

Conversation

@joomdonation
Copy link
Copy Markdown
Contributor

Pull Request resolves #47693.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Currently, if version history is enabled for a component, every view extends FormView class from that component will have Versions button shown, even if that view does not really support versions history. This PR just fixes that wrong behavior. The button will only be shown if:

  • Versions History is enabled for the component
  • The model associated with the view implements VersionableModelInterface (the modern version history implement supported from 6.0)
  • Or the associated table implements VersionableModelInterface

Testing Instructions

  • Enable Versions History for com_content. Then edit an article and make sure Versions button is still being displayed
  • Disable Versions History for com_conent. Then edit an article and make sure Versions button is not being displayed

Basically, make sure versions history still work with this PR applied. Then we will wait for @Ruud68 test confirms that it works well for his custom extension

Actual result BEFORE applying this Pull Request

Versions button is always shown for every views extends FormView class even if that view does not support versions history

Expected result AFTER applying this Pull Request

Versions button is only shown for views extends FormView class if that view support versions history

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@exlemor
Copy link
Copy Markdown

exlemor commented Apr 27, 2026

I have tested this item ✅ successfully on 609eba2

I have successfully tested this! Thanks @joomdonation!


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

@Ruud68
Copy link
Copy Markdown
Contributor

Ruud68 commented Apr 27, 2026

Hi @joomdonation thanks for picking this up and creating the PR for it.

Just tested it and it works, would suggest one small change:
you have created a method responsible for checking if a view can / should have versionhistory enabled.
This actual check is now currently 'split'. My suggestion would be to add $this->state->get('params')->get('save_history', 0) check also in the protected function supportVersionHistory() as that would make it more 'clean' IMO.

@joomdonation
Copy link
Copy Markdown
Contributor Author

Thanks @Ruud68. Implemented the suggested change, also renaming the method to fit the code better. Could you please check it again? If it works, please report your test result so that the PR can be merged. Thanks

@Ruud68
Copy link
Copy Markdown
Contributor

Ruud68 commented Apr 27, 2026

I have tested this item ✅ successfully on f703205

Thanks @joomdonation


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

@joomdonation
Copy link
Copy Markdown
Contributor Author

@exlemor There was a small change after you tested the PR, so when you have a moment, please help testing it again. Thanks !

@exlemor
Copy link
Copy Markdown

exlemor commented Apr 27, 2026

I have tested this item ✅ successfully on f703205

I have re-tested this PR successfully! Thanks @joomdonation!


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

@joomdonation
Copy link
Copy Markdown
Contributor Author

Thanks @exlemor for re-testing.

@joomdonation
Copy link
Copy Markdown
Contributor Author

RTC. Thanks all for feedback and testing.


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-6.1-dev RTC This Pull Request is Ready To Commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants