RTC bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar CSGoat0
CSGoat0
6 May 2026

Pull Request resolves #39268.

  • 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

canEdit() is fixed: it was reading $contentTypeTable->type_alias on a ContentType table object that was never loaded, so the value was always empty. It now correctly uses the locally built $typeAlias string, and the unused $contentTypeTable instantiation was removed.

Testing Instructions

  1. Log in as Super User to the administrator backend

  2. Create a test user with Author rights:

    • Go to Users → Manage → Add New User
    • Fill in:
      • Name: Test Author
      • Username: testauthor
      • Email: author@example.com
      • Password: write something you will remember
    • Under Assigned User Groups, select Author and remove anything else.
    • Click Save & Close
  3. Create an article owned by the Author:

    • Go to Content → Articles → New
    • Title: Test Article – Version Preview
    • Content: This is version 1 content.
    • Status: Published
    • Access: Public
    • Navigate to Publishing tab then set Created By: to Test Author
    • Click Save & Close
  4. Edit the article:

    • Open the same article again
    • Change content to: This is version 2 content.
    • Click Save & Close
  5. Versions Check:

    • Navigate to the Frontend
    • Log in as the testauthor
    • Navigate to the target article, Test Article – Version Preview
    • Click Edit (note: You shouldn't open the edit view at frontend and backend together, it's not applicable for the same article).
    • At the bottom, you can find Versions, click it.

Actual result BEFORE applying this Pull Request

The preview popup returns a 403 Access Denied error for Author-group users. The same user can open the article for editing without issue, but cannot preview historical versions.

Expected result AFTER applying this Pull Request

The preview popup opens successfully and displays the historical version data. Behaviour matches Joomla 3.10.x where Authors could preview versions of their own articles.

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

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar CSGoat0 CSGoat0 - open - 6 May 2026
avatar CSGoat0 CSGoat0 - change - 6 May 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 May 2026
Category Administration com_content com_contenthistory
avatar richard67 richard67 - change - 6 May 2026
Labels Added: PR-5.4-dev
avatar Rolli1962
Rolli1962 - comment - 6 May 2026

Checked on a J6.1.0 System. Is working, user with author-rights now is able to open previews. Thx!

avatar joomdonation
joomdonation - comment - 6 May 2026

@CSGoat0 Version History works for different content type, not just article, so you cannot hard code the check to article like that. I haven't tried but I think the issue comes from this line https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L143. $contentTypeTable is just a new table object, it hasn't loaded data from database yet, so I don't think it is right to use $contentTypeTable->type_alias here. Maybe you can try to change $contentTypeTable->type_alias in that line of code to just $typeAlias (seems logical to me) to see if it solves the issue?

avatar joomdonation
joomdonation - comment - 6 May 2026

@CSGoat0 Version History works for different content type, not just article, so you cannot hard code the check to article like that. I haven't tried but I think the issue comes from this line https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L143. $contentTypeTable is just a new table object, it hasn't loaded data from database yet, so I don't think it is right to use $contentTypeTable->type_alias here. Maybe you can try to change $contentTypeTable->type_alias in that line of code to just $typeAlias (seems logical to me) to see if it solves the issue?

I should have posted the comment directly in the code section, but for some reasons, It could not be submitted, so I had to add new comment here.

avatar CSGoat0
CSGoat0 - comment - 6 May 2026

@CSGoat0 Version History works for different content type, not just article, so you cannot hard code the check to article like that. I haven't tried but I think the issue comes from this line https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L143. $contentTypeTable is just a new table object, it hasn't loaded data from database yet, so I don't think it is right to use $contentTypeTable->type_alias here. Maybe you can try to change $contentTypeTable->type_alias in that line of code to just $typeAlias (seems logical to me) to see if it solves the issue?

I should have posted the comment directly in the code section, but for some reasons, It could not be submitted, so I had to add new comment here.

Nice catch, I have tried both and you are right.
I updated the code.

avatar joomdonation
joomdonation - comment - 6 May 2026

There are still many unrelated changes. As mentioned, I think the only change needed is modify this line of code https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L143, change change $contentTypeTable->type_alias in that line of code to just $typeAlias , all other changes could be reverted.

avatar CSGoat0
CSGoat0 - comment - 6 May 2026

There are still many unrelated changes. As mentioned, I think the only change needed is modify this line of code https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L143, change change $contentTypeTable->type_alias in that line of code to just $typeAlias , all other changes could be reverted.

I reverted it back, I have also removed the $user->authorise('core.edit', $table->item_id) at getItem() as it's double checked.
Thanks for the help, also everything works fine.

avatar joomdonation
joomdonation - comment - 6 May 2026

Yes, looks good. Could you also remove these lines of code https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L137-L138 ? The variable $contentTypeTable is not used anymore, thus it should be removed.

avatar joomdonation
joomdonation - comment - 6 May 2026

Also, with your edit, the $user variable at this line https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L55 should also be removed because it is not used anymore. Not sure if it is github issue or my internet connection, I could not comment directly in the code area

avatar CSGoat0
CSGoat0 - comment - 6 May 2026

Also, with your edit, the $user variable at this line https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_contenthistory/src/Model/PreviewModel.php#L55 should also be removed because it is not used anymore. Not sure if it is github issue or my internet connection, I could not comment directly in the code area

All set, boss.

avatar joomdonation
joomdonation - comment - 6 May 2026

Looks good to me now, thanks. @Rolli1962 Could you please test it again ?

avatar Rolli1962
Rolli1962 - comment - 6 May 2026

Tested again with J6.1.0 - is working fine!

avatar CSGoat0 CSGoat0 - change - 7 May 2026
The description was changed
avatar CSGoat0 CSGoat0 - edited - 7 May 2026
avatar muhme
muhme - comment - 8 May 2026

Tested again with J6.1.0 - is working fine!

@Rolli1962 Thank you for testing. Could you also test this PR with Joomla 5.4 and note the result in Joomla issue tracker? This would be great.

avatar ThomasFinnern ThomasFinnern - test_item - 8 May 2026 - Tested successfully
avatar ThomasFinnern
ThomasFinnern - comment - 8 May 2026

I have tested this item ✅ successfully on 932ec53

Did create user and artice, have seen the error in frontend logged in as test user .
After applying the path the error was gone


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

avatar ThomasFinnern
ThomasFinnern - comment - 8 May 2026

I have tested this item ✅ successfully on 932ec53

Did create user and artice, have seen the error in frontend logged in as test user .
After applying the path the error was gone


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

avatar krishnagandhicode krishnagandhicode - test_item - 8 May 2026 - Tested successfully
avatar krishnagandhicode
krishnagandhicode - comment - 8 May 2026

I have tested this item ✅ successfully on 932ec53

Tested successfully during PR Testing meet.


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

avatar krishnagandhicode
krishnagandhicode - comment - 8 May 2026

I have tested this item ✅ successfully on 932ec53

Tested successfully during PR Testing meet.


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

avatar Rolli1962
Rolli1962 - comment - 8 May 2026

Sorry, all my sites are running with J6.1 - including test-sites. A test with J5.4 was done in the meantime by TomasFinnern (thx). Hope those will help.

avatar joomdonation joomdonation - change - 8 May 2026
Status Pending Ready to Commit
avatar joomdonation
joomdonation - comment - 8 May 2026

RTC


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

avatar joomdonation
joomdonation - comment - 8 May 2026

RTC


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

avatar richard67 richard67 - change - 9 May 2026
Labels Added: RTC bug
avatar richard67 richard67 - change - 10 May 2026
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2026-05-10 10:05:42
Closed_By richard67
avatar richard67 richard67 - close - 10 May 2026
avatar richard67 richard67 - merge - 10 May 2026
avatar richard67
richard67 - comment - 10 May 2026

Thanks @CSGoat0 for this PR, @ThomasFinnern and @krishnagandhicode for testing, and @joomdonation for reviw and support.

Add a Comment

Login with GitHub to post a comment