Skip to content

Fix for "What's new" content visible when it shouldn't be #21341

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

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Oct 3, 2023

Description:

The "What's new" feature loaded change items from each plugin's changes.json file into the database, however this is happening even for plugins that are deactivated.

This PR changes this behaviour to:

  • Load the changes into the database only when a plugin is activated/updated
  • Remove the changes from the database when a plugin is deactivated
  • Remove the automatic plugin name prefix when displaying the changes for the professional services plugin

Review

…ed, don't show plugin name prefix in title for professional services plugin
@bx80 bx80 added the Bug For errors / faults / flaws / inconsistencies etc. label Oct 3, 2023
@bx80 bx80 added this to the 5.0.0 milestone Oct 3, 2023
@bx80 bx80 self-assigned this Oct 3, 2023
@bx80 bx80 added the Needs Review PRs that need a code review label Oct 3, 2023
'Updater.componentUpdated' => 'addPluginChanges',
'PluginManager.pluginUninstalled' => 'removePluginChanges'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct here to remove the hook for the plugin uninstallation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michalkleiner Yes that's intentional, plugins are deactivated before they are uninstalled so the removePluginChanges() method will still be run when uninstalling, but also now if a plugin is deactivated but not uninstalled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually not fully correct. Uninstalling a plugin triggers the deactivate method within the plugin class (if found). But that will actually not trigger the event.
The UI only provides an uninstall link for deactivated plugins, but there might be a scenario where you can uninstall a plugin in the UI without deactivating it first. Haven't tested that, but when you remove the plugin directly in the filesystem, I think the system will report it as broken, with the option to uninstall it. But the deactivate might not be triggered in that case.
Also there could be other scanarios where an activated plugin is uninstalled without a manual deactivation before. So might be better to keep that event as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bx80 do we want to return the event hook? It should cause no harm, right? Or would it effectively run twice and cause problems?

@bx80 bx80 requested a review from michalkleiner October 4, 2023 23:41
Copy link
Contributor

@michalkleiner michalkleiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes correspond with the description of what the changes should do, so I think this is all good.

@bx80 bx80 merged commit 98774c8 into 5.x-dev Oct 5, 2023
@bx80 bx80 deleted the dev17223-what-is-new-tweaks branch October 5, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review
Development

Successfully merging this pull request may close these issues.

3 participants