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

[5.1] Correct message type for Redirect plugin state #43402

Merged
merged 6 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function display($tpl = null)
throw new GenericDataException(implode("\n", $errors), 500);
}

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

Expand Down
10 changes: 6 additions & 4 deletions administrator/components/com_redirect/tmpl/links/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Redirect\Administrator\Helper\RedirectHelper;
Expand All @@ -32,11 +33,12 @@
$listDirn = $this->escape($this->state->get('list.direction'));

$collectUrlsEnabled = RedirectHelper::collectUrlsEnabled();
$pluginEnabled = PluginHelper::isEnabled('system', 'redirect');
$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');
if ($pluginEnabled && $collectUrlsEnabled) {
$app->enqueueMessage(Text::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED')), 'notice');
} else {
$popupOptions = [
'popupType' => 'iframe',
Expand All @@ -56,10 +58,10 @@
],
);

if (!$redirectPluginId && !$collectUrlsEnabled) {
if ($pluginEnabled && !$collectUrlsEnabled) {
$app->enqueueMessage(
Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link),
'warning'
'notice'
);
} else {
$app->enqueueMessage(Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link), 'error');
Expand Down
10 changes: 6 additions & 4 deletions administrator/components/com_redirect/tmpl/links/emptystate.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\Component\Redirect\Administrator\Helper\RedirectHelper;

Expand Down Expand Up @@ -42,11 +43,12 @@
}

$collectUrlsEnabled = RedirectHelper::collectUrlsEnabled();
$pluginEnabled = PluginHelper::isEnabled('system', 'redirect');
$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');
if ($pluginEnabled && $collectUrlsEnabled) {
$app->enqueueMessage(Text::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED')), 'notice');
} else {
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
Expand All @@ -70,10 +72,10 @@
],
);

if (!$redirectPluginId && !$collectUrlsEnabled) {
if ($pluginEnabled && !$collectUrlsEnabled) {
$app->enqueueMessage(
Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link),
'warning'
'notice'
);
} else {
$app->enqueueMessage(Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link), 'error');
Expand Down