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

[4.0] Replace filter.condition by filter.published in com_content #30467

Merged
merged 4 commits into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -67,7 +67,7 @@ public function displayList()

if (array_key_exists('state', $apiFilterInfo))
{
$this->modelState->set('filter.condition', $filter->clean($apiFilterInfo['state'], 'INT'));
$this->modelState->set('filter.published', $filter->clean($apiFilterInfo['state'], 'INT'));
}

if (array_key_exists('language', $apiFilterInfo))
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/src/Model/ArchiveModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function populateState($ordering = null, $direction = null)
$params = $this->state->get('params');

// Filter on archived articles
$this->setState('filter.condition', ContentComponent::CONDITION_ARCHIVED);
$this->setState('filter.published', ContentComponent::CONDITION_ARCHIVED);

// Filter on month, year
$this->setState('filter.month', $app->input->getInt('month'));
Expand Down
6 changes: 3 additions & 3 deletions components/com_content/src/Model/ArticlesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function populateState($ordering = 'ordering', $direction = 'ASC')
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content')))
{
// Filter on published for those who do not have edit or edit.state rights.
$this->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED);
$this->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
}

$this->setState('filter.language', Multilanguage::isEnabled());
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function populateState($ordering = 'ordering', $direction = 'ASC')
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . serialize($this->getState('filter.condition'));
$id .= ':' . serialize($this->getState('filter.published'));
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.featured');
$id .= ':' . serialize($this->getState('filter.article_id'));
Expand Down Expand Up @@ -327,7 +327,7 @@ protected function getListQuery()
}

// Filter by published state
$condition = $this->getState('filter.condition');
$condition = $this->getState('filter.published');

if (is_numeric($condition) && $condition == 2)
{
Expand Down
4 changes: 2 additions & 2 deletions components/com_content/src/Model/CategoriesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function populateState($ordering = null, $direction = null)
$params = $app->getParams();
$this->setState('params', $params);

$this->setState('filter.condition', 1);
$this->setState('filter.published', 1);
chmst marked this conversation as resolved.
Show resolved Hide resolved
$this->setState('filter.access', true);
}

Expand All @@ -88,7 +88,7 @@ protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.extension');
$id .= ':' . $this->getState('filter.condition');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.parentId');

Expand Down
6 changes: 3 additions & 3 deletions components/com_content/src/Model/CategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ protected function populateState($ordering = null, $direction = null)
if ((!$user->authorise('core.edit.state', $asset)) && (!$user->authorise('core.edit', $asset)))
{
// Limit to published for people who can't edit or edit.state.
$this->setState('filter.condition', 1);
$this->setState('filter.published', 1);
}
else
{
$this->setState('filter.condition', [0, 1]);
$this->setState('filter.published', [0, 1]);
}

// Process show_noauth parameter
Expand Down Expand Up @@ -263,7 +263,7 @@ public function getItems()
->createModel('Articles', 'Site', ['ignore_request' => true]);
$model->setState('params', Factory::getApplication()->getParams());
$model->setState('filter.category_id', $category->id);
$model->setState('filter.condition', $this->getState('filter.condition'));
$model->setState('filter.published', $this->getState('filter.published'));
$model->setState('filter.access', $this->getState('filter.access'));
$model->setState('filter.language', $this->getState('filter.language'));
$model->setState('filter.featured', $this->getState('filter.featured'));
Expand Down
4 changes: 2 additions & 2 deletions components/com_content/src/Model/FeaturedModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ protected function populateState($ordering = null, $direction = null)
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content')))
{
// Filter on published for those who do not have edit or edit.state rights.
$this->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED);
$this->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
}
else
{
$this->setState('filter.condition', [ContentComponent::CONDITION_UNPUBLISHED, ContentComponent::CONDITION_PUBLISHED]);
$this->setState('filter.published', [ContentComponent::CONDITION_UNPUBLISHED, ContentComponent::CONDITION_PUBLISHED]);
}

// Process show_noauth parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function getList(&$params)
$articles->setState('params', $appParams);

$articles->setState('list.start', 0);
$articles->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED);
$articles->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);

// Set the filters based on the module params
$articles->setState('list.limit', (int) $params->get('count', 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function getList(&$params)
$model->setState('params', $appParams);

$model->setState('list.start', 0);
$model->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED);
$model->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);

// Set the filters based on the module params
$model->setState('list.limit', (int) $params->get('count', 5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function getList(&$params)
$model->setState('params', $appParams);

$model->setState('list.start', 0);
$model->setState('filter.condition', ContentComponent::CONDITION_PUBLISHED);
$model->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);

// Set the filters based on the module params
$model->setState('list.limit', (int) $params->get('count', 5));
Expand Down