RTC bug PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
30 Apr 2024

Pull Request for Issue #43298 .

Summary of Changes

Use "notice" instead of "warning" for informative messages.

Testing Instructions

Please follow #43298

Actual result BEFORE applying this Pull Request

Yellow message

Expected result AFTER applying this Pull Request

Blue message

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

Reference:

avatar Fedik Fedik - open - 30 Apr 2024
avatar Fedik Fedik - change - 30 Apr 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2024
Category Administration com_redirect
avatar Fedik Fedik - change - 30 Apr 2024
The description was changed
avatar Fedik Fedik - edited - 30 Apr 2024
avatar brianteeman
brianteeman - comment - 30 Apr 2024

This does not solve #43298

This is how it should be - note that the message is completely wrong in test 3 and in test 2 it should be info not warning

avatar Fedik
Fedik - comment - 30 Apr 2024

it should be info not warning

It is "notice", as it was before in 5.0 and in j4.

avatar Fedik
Fedik - comment - 30 Apr 2024

tbh, this messages is useless, why do we have them in first place?
Only a warning about disabled plugin is good enough.

avatar brianteeman
brianteeman - comment - 30 Apr 2024

Please READ the report more carefully. The messages are NOT useless.

I realise that there is a lot of variants but currently AND with this PR the following message is completely wrong!!!

When the plugin is enabled any redirects that have been created in the component will take effect.
When the plugin is enabled there is an additional option to collect urls. Collecting urls is independent of redirecting urls.

It says
The Redirect System Plugin is disabled. It needs to be enabled for this component to work.
It should say
The Redirect Plugin is enabled. The 'Collect URLs' option in the Redirect System Plugin is disabled. Error page URLs will not be collected by this component.

I am wondering now if you did not realise the complete use of the plugin and component when you rewrote this part of the code as it makes no sense.

The current code as changed in #42447 is simply wrong.

You never check if the plugin is enabled or disabled. You only check if the plugin exists

avatar Fedik
Fedik - comment - 30 Apr 2024

It is (almsot) 1:1 copy of what was before:
Old:

$pluginEnabled = PluginHelper::isEnabled('system', 'redirect');
$collectUrlsEnabled = RedirectHelper::collectUrlsEnabled();
// Show messages about the enabled plugin and if the plugin should collect URLs
if ($pluginEnabled && $collectUrlsEnabled) {
$this->app->enqueueMessage(Text::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED')), 'notice');
} else {
$redirectPluginId = RedirectHelper::getRedirectPluginId();
$link = HTMLHelper::_(
'link',
'#plugin' . $redirectPluginId . 'Modal',
Text::_('COM_REDIRECT_SYSTEM_PLUGIN'),
'class="alert-link" data-bs-toggle="modal" id="title-' . $redirectPluginId . '"'
);
if ($pluginEnabled && !$collectUrlsEnabled) {
$this->app->enqueueMessage(
Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link),
'notice'
);
} else {
$this->app->enqueueMessage(Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link), 'error');
}
}

New:

$collectUrlsEnabled = RedirectHelper::collectUrlsEnabled();
$redirectPluginId = $this->redirectPluginId;
// Show messages about the enabled plugin and if the plugin should collect URLs
if (!$redirectPluginId && $collectUrlsEnabled) {
$app->enqueueMessage(Text::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED')), 'warning');
} else {
$popupOptions = [
'popupType' => 'iframe',
'textHeader' => Text::_('COM_REDIRECT_EDIT_PLUGIN_SETTINGS'),
'src' => Route::_('index.php?option=com_plugins&client_id=0&task=plugin.edit&extension_id=' . $redirectPluginId . '&tmpl=component&layout=modal', false),
];
$link = HTMLHelper::_(
'link',
'#',
Text::_('COM_REDIRECT_SYSTEM_PLUGIN'),
[
'class' => 'alert-link',
'data-joomla-dialog' => $this->escape(json_encode($popupOptions, JSON_UNESCAPED_SLASHES)),
'data-checkin-url' => Route::_('index.php?option=com_plugins&task=plugins.checkin&format=json&cid[]=' . $redirectPluginId),
'data-close-on-message' => '',
'data-reload-on-close' => '',
],
);
if (!$redirectPluginId && !$collectUrlsEnabled) {
$app->enqueueMessage(
Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link),
'warning'
);
} else {
$app->enqueueMessage(Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link), 'error');
}
}

Maybe something wrong with redirectPluginId or with that if() condition, who knows.

avatar brianteeman
brianteeman - comment - 30 Apr 2024

Its not the same - this is where the mistake is

ORIG

$pluginEnabled = PluginHelper::isEnabled('system', 'redirect');
$collectUrlsEnabled = RedirectHelper::collectUrlsEnabled();

NEW

$collectUrlsEnabled = RedirectHelper::collectUrlsEnabled();
$redirectPluginId = $this->redirectPluginId;

redirectPluginId gets the ID of the plugin
pluginEnabled gets the state of the plugin

avatar Fedik
Fedik - comment - 30 Apr 2024

redirectPluginId gets the ID of the plugin

It is there only when the plugin is disabled

if (!(PluginHelper::isEnabled('system', 'redirect') && RedirectHelper::collectUrlsEnabled())) {
$this->redirectPluginId = RedirectHelper::getRedirectPluginId();
}

avatar brianteeman
brianteeman - comment - 30 Apr 2024

I give up - I am clearly unable to explain what should be very obvious. Your changed code in #42447 produces the wrong message and this PR makes no changes to correct that.

Instead of saying

The Redirect Plugin is enabled. The 'Collect URLs' option in the Redirect System Plugin is disabled. Error page URLs will not be collected by this component.

Your code says

The Redirect System Plugin is disabled. It needs to be enabled for this component to work.

avatar Fedik
Fedik - comment - 30 Apr 2024

I give up

Don't give up

avatar brianteeman
brianteeman - comment - 30 Apr 2024

I dont know how else to explain the obvious

avatar Fedik Fedik - change - 30 Apr 2024
Labels Added: bug PR-5.1-dev
avatar Fedik
Fedik - comment - 30 Apr 2024

Should work now.
See, it was easy ;)

avatar brianteeman
brianteeman - comment - 30 Apr 2024

image

avatar Fedik
Fedik - comment - 30 Apr 2024

But messages are good? :)
Changed that also, check again.

avatar brianteeman brianteeman - test_item - 30 Apr 2024 - Tested successfully
avatar brianteeman
brianteeman - comment - 30 Apr 2024

I have tested this item ✅ successfully on 3e9f660


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

avatar viocassel viocassel - test_item - 2 May 2024 - Tested successfully
avatar viocassel
viocassel - comment - 2 May 2024

I have tested this item ✅ successfully on 3e9f660


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

avatar alikon alikon - change - 2 May 2024
Status Pending Ready to Commit
avatar alikon
alikon - comment - 2 May 2024

RTC


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

avatar Quy Quy - change - 10 May 2024
Labels Added: RTC
avatar bembelimen bembelimen - close - 11 May 2024
avatar bembelimen bembelimen - merge - 11 May 2024
avatar bembelimen bembelimen - change - 11 May 2024
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-05-11 09:12:17
Closed_By bembelimen
avatar bembelimen
bembelimen - comment - 11 May 2024

Thanks!

Add a Comment

Login with GitHub to post a comment