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

[#43505] Fixed not showing the changelog URL contents #44626

Open
wants to merge 2 commits into
base: 5.2-dev
Choose a base branch
from

Conversation

roland-d
Copy link
Contributor

Pull Request for Issue #43505.

Summary of Changes

The transport options write the body to the stream interface, by doing so the pointer gets placed at the end of the stream. Any code that uses the Response class to get the body will get an empty string instead of the read data. So we need to rewind the cursor before returning the response.

In addition the Changelog class should not access the body directly but use the getBody()->getContents() function.

Testing Instructions

  1. Setup the changelog feature as explained in https://manual.joomla.org/docs/building-extensions/install-update/installation/change-log/ for any extension in your site
  2. Click on the version number in the extensions manage list
  3. Notice that only the modal opens with the title
  4. Apply the patch
  5. Click on the version number again
  6. Notice that only the modal opens with the title and the changelog

Before:
image

After:
image

Actual result BEFORE applying this Pull Request

A modal is shown with only the title

Expected result AFTER applying this Pull Request

The modal is shown with the changelog entries

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

@robbiejackson
Copy link

I'm afraid this PR doesn't address issue #43505 which is concerned with the changelog associated with the update server xml file, not the changelog associated with the installed extension xml file.

So #43505 is about the changelog in the Extensions: Update list, not the changelog in the Extensions: Manage list. Please see the Additional Comments in #43505 for more explanation.

@roland-d
Copy link
Contributor Author

@robbiejackson I will check that scenario as well. Since I saw the issue happening with the installed extension I forgot about the update server.

@roland-d
Copy link
Contributor Author

@robbiejackson I see now what you are trying to say in your issue. We should load the changelogurl based on the view we are in. This PR has now been updated to use the updates table when in the update view but with a fallback to the extension table changelog URL. This ensures backwards compatibility.

@robbiejackson
Copy link

I personally think that in the updates view there shouldn't be any fallback to the extensions table. From the user perspective if he/she sees a changelog against an updated version of an extension, then the changelog only for that version should be shown, and just an error message if the software encounters a problem. It shouldn't revert to showing the changelog for the previous version at all (which is what you'd get if you used the link in the extensions table). That doesn't make sense to me.

@roland-d
Copy link
Contributor Author

In that case it becomes a question if it is a B/C break, which I guess it is. I can have the changelog for the current and new versions in 1 file.

I do not think you will see the changelog for the previous version because the code checks the changelog for the version number. This must match the version of the update.

@robbiejackson
Copy link

Remember that this is a bug fix, not a feature enhancement. Bug fixes are not supposed to be backwardly compatible!

@robbiejackson
Copy link

I've tested this and it's displaying the update changelog ok.

If it can't load the changelog then it would be nice if it displayed an error message to the user (rather than it just being blank), but at least it reports the error in the log file.

I still think it would be better to simplify the code so that you never used the extension changelog in the update scenario, ie line 431 just have

    if ($source === 'update' && !$extension->updateChangelogurl) {
        return '';
    }

and then in line 437:

    $changelog->loadFromXml($source === 'manage' ? $extension->changelogurl : $extension->updateChangelogurl);

However, users only get to this code via the blue Changelog button on the Updates form, and in that case the $extension->updateChangelogurl should always be set, so I'm not going to make an issue of this.

I don't know where the blue "Test" button is to register a test, but if you let me know then I'll do that.

I don't feel qualified to test the other aspects of this PR though.

Finally, many thanks for fixing this problem!

@alikon
Copy link
Contributor

alikon commented Dec 17, 2024

with pr #44565 appliyed i cannot replicate

image

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.

4 participants