? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
16 May 2021

Pull Request for Issue # .

Summary of Changes

Our ListModel is smart enough to populate model states automatically, so we do not have to write code to populate value for individual states anymore. From what I see, manual populating model states like this is only needed for Joomla 3 because we have to support Hathor, a template which does not use search tools for filtering data.

This PR is made to see if it could be accepted. If it is accepted, similar clean up code be made for some other model classes in our codebase

Testing Instructions

  1. Apply patch
  2. Access to Users -> User Actions Log, try to filter action logs search by searching, filter by component, date range... and make sure it is still working as expected.
avatar joomdonation joomdonation - open - 16 May 2021
avatar joomdonation joomdonation - change - 16 May 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 May 2021
Category Administration
avatar PhilETaylor
PhilETaylor - comment - 16 May 2021

the only thing that is left is a call to the parent class - does that mean you can actually remove this whole method and allow inheritance to happen, meaning the parent method will get called instead auto-magically?

avatar joomdonation
joomdonation - comment - 16 May 2021

@PhilETaylor No, we cannot remove it. We need to leave it here so that default ordering is a.id desc (see default values for the parameters of the method)

avatar PhilETaylor
PhilETaylor - comment - 16 May 2021

Are those params different in the parent method then? Sorry I cannot check quite now as I am mobile, and driving

Sent from my iPhone

On 16 May 2021, at 14:46, Tuan Pham Ngoc @.***> wrote:


@PhilETaylor No, we cannot remove it. We need to leave it here so that default ordering is a.id desc (see default values for the parameters of the method)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

avatar joomdonation
joomdonation - comment - 16 May 2021

Yes, Phil. For parent method, the default value for these parameters are null

protected function populateState($ordering = null, $direction = null)

avatar PhilETaylor
PhilETaylor - comment - 16 May 2021

Awesome - thanks for explaining - I'll mark a test when I'm home later if still needed

avatar joomdonation
joomdonation - comment - 16 May 2021

Thanks Phil. Maybe we should ask maintainers to see if they want this clean up first. @wilsonge @HLeithner Do you think we should go with this code clean up?

avatar wilsonge
wilsonge - comment - 16 May 2021

Yeah if this works we should definitely clean it up this way. Just check what state the API filters on when your rolling this out (we can move it to the new search tools style state names - just need to make sure it's not breaking API filters)

avatar joomdonation
joomdonation - comment - 16 May 2021

@wilsonge The filters form within Users Action Logs still work in the same way as before. The only thing was changed is that if we remove these code, someone could not initialize value for a model state using this code (could be used before redirecting to com_actionlogs component)

Factory::getApplication()->setUserState('com_actionlogs.actionlogsfilter.search', 'initialize search value');

They will have to use new code such as

Factory::getApplication()->setUserState('com_actionlogs.actionlogs.filter', ['search' => 'initialize search value']);

We do not use any of these code in our code base. So will this change be OK?

avatar joomdonation
joomdonation - comment - 16 May 2021

I don't understand your idea/request below, could you please explain more what I need to check to make sure it won't break our API?

Just check what state the API filters on when your rolling this out (we can move it to the new search tools style state names - just need to make sure it's not breaking API filters)

avatar wilsonge
wilsonge - comment - 16 May 2021

I think this specific PR is fine. But some of the API sets these older style filters (e.g. https://github.com/joomla/joomla-cms/blob/4.0-dev/api/components/com_content/src/Controller/ArticlesController.php#L65). We'll need to clean them up - I guess thinking about it we should be able to automatically allow using these filters from the XML files rather than doing it manually like we are there...

avatar wilsonge wilsonge - change - 17 May 2021
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-05-17 21:32:10
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 17 May 2021
avatar wilsonge wilsonge - merge - 17 May 2021

Add a Comment

Login with GitHub to post a comment