? Pending

User tests: Successful: Unsuccessful:

avatar heelc29
heelc29
11 Apr 2022

Summary of Changes

check sampledata type before execute onAjaxSampledataApplyStep9 in testing plugin

Testing Instructions

install a sampledata plugin with more than 9 steps

Actual result BEFORE applying this Pull Request

Message Testing Sample Data has been installed! appears

Expected result AFTER applying this Pull Request

Message Testing Sample Data has been installed! doesn't appears

Documentation Changes Required

none

avatar heelc29 heelc29 - open - 11 Apr 2022
avatar heelc29 heelc29 - change - 11 Apr 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 Apr 2022
Category Front End Plugins
avatar brianteeman
brianteeman - comment - 11 Apr 2022

obviously this is not correct

avatar heelc29
heelc29 - comment - 13 Apr 2022

obviously this is not correct

@brianteeman What do you mean? The PR or that the function is called during execution of other sampledata plugins?

avatar heelc29 heelc29 - change - 13 Apr 2022
Labels Added: ?
avatar brianteeman
brianteeman - comment - 13 Apr 2022

think about it

avatar brianteeman
brianteeman - comment - 15 Apr 2022
  1. this php file is for that specific set of sample data which only has 9 sets
  2. the number of steps is also defined on line 87
  3. This plugin is neveer shipped with core
avatar heelc29
heelc29 - comment - 18 Apr 2022

I know is that the "Testing Sample Data" is not included in any release (production sites)

I'm not sure if I described it correctly above. I don't want to run the testing plugin, I want to run another plugin (with more than 9 steps in test environment)

This is the result:
image

Because com_ajax doesn't trigger any special plugin, just the function name onAjaxSampledataApplyStep9

$results = Factory::getApplication()->triggerEvent('onAjax' . $plugin);

Therefore, every plugin has to check the requested type (and session token) before execution

if (!Session::checkToken('get') || $this->app->input->get('type') != $this->_name)
{
return;
}

PS: The message of the last step is never shown because the finished message appears at the same moment

image

// Move on next step
if (success && (step <= steps)) {
const stepNew = step + 1;
if (stepNew <= steps) {
sampledataAjax(type, steps, stepNew);
} else {
const bar = document.querySelector(`.sampledata-progress-${type}`);
bar.parentNode.removeChild(bar);
Joomla.renderMessages({ message: [Joomla.Text._('MOD_SAMPLEDATA_COMPLETED')] });
window.scroll({
top: 0,
left: 0,
behavior: 'smooth',
});
SampleData.inProgress = false;
}
}

avatar brianteeman
brianteeman - comment - 18 Apr 2022

I don't want to run the testing plugin, I want to run another plugin (with more than 9 steps in test environment)

I know. So why are you not writing your plugin correctly. editing this plugin makes no sense (plus as already pointed out the change is wrong anyway)

avatar heelc29
heelc29 - comment - 18 Apr 2022

So why are you not writing your plugin correctly

I don't know exactly what you mean by that (all is core)? I can't change anything on "my" plugin so that the message from plg_sampledata_testing doesn't appear, right? (even if this only happens in the test environment)

pointed out the change is wrong anyway

Why (I can only understand point 3)? The other plugins also have this condition in the last step.

public function onAjaxSampledataApplyStep4()
{
if ($this->app->input->get('type') != $this->_name)
{
return;
}

public function onAjaxSampledataApplyStep8()
{
if ($this->app->input->get('type') !== $this->_name)
{
return;
}

avatar brianteeman
brianteeman - comment - 18 Apr 2022

I can't change anything on "my" plugin so that the message from plg_sampledata_testing doesn't appear, right?

Wrong. Your plugin should be completely indpendent

avatar heelc29
heelc29 - comment - 18 Apr 2022

Wrong. Your plugin should be completely indpendent

I think its independent ... (contains only sleep)

Uploded to: https://github.com/heelc29/plg_sampledata_joomla

avatar brianteeman
brianteeman - comment - 18 Apr 2022

I repeat again and for the last time. Your own sample data plugin has nothing to do with the sample data plugin in core that this pr is editing

avatar heelc29
heelc29 - comment - 18 Apr 2022

Your own sample data plugin has nothing to do with the sample data plugin in core

Yes, of course, I never said that.

For the moment if no one use any 3rd party sampledata plugins with more then 9 steps (in test environment) the situation does not occur.

If (someone in future ?) removing some steps of testing plugin or adding some steps to multilang plugin (currently 8 steps) this bug will occur and why should it not fixed now.

If this is not necessary, we can close the PR.

avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull requests has automatically rebased to 4.2-dev.

avatar heelc29 heelc29 - change - 27 Jun 2022
Title
[4.1] Sampledata testing message
[4.2] Sampledata testing message
avatar heelc29 heelc29 - edited - 27 Jun 2022
avatar heelc29 heelc29 - change - 27 Jun 2022
Labels Added: ?
avatar brianteeman
brianteeman - comment - 27 Jun 2022

This is still completely wrong. This file is ONLY used by the testing plugin. it is not used by any other plugin in core and it will not be used by any plugin someone adds. If in the future more steps are added to the multilang sample data then it doesnt matter what change is made in this file - it will have zero effect. Please just think about it.

avatar heelc29 heelc29 - change - 22 Jul 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-07-22 19:06:54
Closed_By heelc29
Labels Removed: ?
avatar heelc29 heelc29 - close - 22 Jul 2022

Add a Comment

Login with GitHub to post a comment