Skip to content

[5.3] Restored Article Version Now Properly Checked Out to Current User#45597

Merged
rdeutz merged 13 commits intojoomla:5.3-devfrom
travisrisner:versioning-checkedoutuser
Aug 25, 2025
Merged

[5.3] Restored Article Version Now Properly Checked Out to Current User#45597
rdeutz merged 13 commits intojoomla:5.3-devfrom
travisrisner:versioning-checkedoutuser

Conversation

@travisrisner
Copy link
Contributor

Pull Request for Issue #45586 .

Summary of Changes

This pull request addresses an issue where restoring a previous article version in Joomla causes the article to be locked (checked_out) to the original author of that version, rather than the current user performing the restore.

Testing Instructions

  1. Create two admin accounts.
  2. Login as USER1, create and save an article, then make a few edits and save multiple times to create version history (on the last one make sure to not save & close, just go save & go back to the dashboard and logout)
  3. Log in as USER2 and open the same article.
  4. Restore the previous version that wasn't set to save & close.
  5. It should now show a Save & Close button for USER2 because the checked_out value is set to the USER2 id instead of retaining the USER1 value.

Actual result BEFORE applying this Pull Request

If a previous verison was restored that was had USER1's id stored as the checked_out value, it would only show a Save to Menu or Save as Copy button.

Expected result AFTER applying this Pull Request

Restored article is checked out the actual user restoring the article, so proper buttons show up.

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

Co-authored-by: Brian Teeman <brian@teeman.net>
@muhme
Copy link
Contributor

muhme commented Jul 25, 2025

@travisrisner Thank you for your contribution. As test preparation I updated the branch. The PR has deprecations, to be fixed. Could you please check failed PHPstan? It shows you which lines failed and gives hint for fixing.

@muhme muhme added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jul 25, 2025
@muhme muhme removed the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jul 25, 2025
@muhme
Copy link
Contributor

muhme commented Jul 25, 2025

I have tested this item ✅ successfully on 2463e9f


Adopting Testing Instructions sligthly

  • Opening the article fails with error: 'Check-out failed with the following error: The user checking out does not match the user who checked out the item..'
    1. Log in as USER2 and open the same article, after unlocking the article in doing 'Check-in'.

Tested with JBT, before applying this PR:

  • Version restored from different user has only 'Save as Copy' menu

After applying the PR with graft Joomla_5.3.3-dev+pr.45597-Development-Full_Package.zip

  • Version restored from different user has also 'Save' and 'Save & Close' buttons, booth buttons are working and different old versions are restorable for the second user
  • Tested with third user with only Publisher rights, restoring 2nd version from frontend is working

Unfortunally found a new error, but this exists already before this PR, see #45782


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

@exlemor
Copy link

exlemor commented Jul 25, 2025

I have tested this item ✅ successfully on 2463e9f

Hi, I have successfully tested this! Thanks Travis for figuring out the logic!

(and thanks to @muhme because I had the same 'Check-out failed with the following error: The user checking out does not match the user who checked out the item..' message and thought, darn I did something wrong).


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

@richard67 richard67 added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jul 25, 2025
@richard67
Copy link
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 25, 2025
@richard67 richard67 removed the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jul 25, 2025
@rdeutz rdeutz added Updates Requested Indicates that this pull request needs an update from the author and should not be tested. and removed RTC This Pull Request is Ready To Commit labels Aug 5, 2025
@brianteeman
Copy link
Contributor

@rdeutz what updates are needed?

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 15, 2025
@richard67
Copy link
Member

@rdeutz what updates are needed?

@brianteeman That's a naughty behaviour of the issue tracker when not being up to date with the labels. It adds them back as soon as something else changes via the issue tracker. I will remove the label and trigger a branch update. The latter will update the labels in the issue tracker so that will not happen again with this PR.

@richard67 richard67 removed the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Aug 24, 2025
@rdeutz
Copy link
Contributor

rdeutz commented Aug 24, 2025

@brianteeman because you are in a model context "Factory::getApplication()->getIdentity()" can be replaced with "$this->getCurrentUser()"

@richard67
Copy link
Member

@rdeutz Now after your last change it needs to remove the obsolete use Joomla\CMS\Factory; in line 59 to make the CS check happy.

removed no longer needed use statement
@rdeutz
Copy link
Contributor

rdeutz commented Aug 24, 2025

Thanks @richard67 I have removed it.

@exlemor
Copy link

exlemor commented Aug 24, 2025

I have tested this item ✅ successfully on 1847c70

I 'just' re-tested in the last 5 minutes and successfully again ! :) Thanks for the work and persistence @travisrisner.


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

@rdeutz rdeutz enabled auto-merge (squash) August 25, 2025 09:16
@rdeutz
Copy link
Contributor

rdeutz commented Aug 25, 2025

Thanks

@rdeutz rdeutz merged commit 99365b3 into joomla:5.3-dev Aug 25, 2025
39 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 25, 2025
@richard67 richard67 added this to the Joomla! 5.3.4 milestone Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants