Pending

User tests: Successful: Unsuccessful:

avatar artur-stepien
artur-stepien
8 Oct 2024

There was a bug in state filtering of CategoryModel that lead to administrators seeing trashed items in the front-end.

Summary of Changes

Changed the state filter to filter the contact items.

Testing Instructions

  • Create 2 contacts: contact A and contact B to Uncategorized
  • Move contact B to Trash
  • Create a front-end menu item of type List Contacts in a Category and select Uncategorized
  • Visit front-end logged in as a Super Administrator and click the menu item created in previous step

Actual result BEFORE applying this Pull Request

Both contacts visible

Expected result AFTER applying this Pull Request

Only contact A should be visible

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

avatar artur-stepien artur-stepien - open - 8 Oct 2024
avatar artur-stepien artur-stepien - change - 8 Oct 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Oct 2024
Category Front End com_contact
avatar artur-stepien
artur-stepien - comment - 8 Oct 2024

There has to be another PR for category state filtering but the problem is 4.4 does not have subcategories filtering. Should I create a separate PR adding category state filtering for 4.4 and 5.1?

avatar brianteeman
brianteeman - comment - 8 Oct 2024

It is not a bug it is the intended behaviour

image

avatar artur-stepien
artur-stepien - comment - 8 Oct 2024

How on earth showing trashed items only in the Contact component front-end is an intended behaviour?

avatar brianteeman
brianteeman - comment - 8 Oct 2024

How on earth showing trashed items only in the Contact component front-end is an intended behaviour?

The same with articles. Otherwise the admin is not able to untrash/publish etc a contact when managing in the front end. That is why the state of the contact is displayed. (Perhaps you have a template which is overriding this view and not displaying the status

avatar artur-stepien
artur-stepien - comment - 8 Oct 2024

How on earth showing trashed items only in the Contact component front-end is an intended behaviour?

The same with articles. Otherwise the admin is not able to untrash/publish etc a contact when managing in the front end. That is why the state of the contact is displayed. (Perhaps you have a template which is overriding this view and not displaying the status

It doesn't work like this in the Content component. And I just checked that to be sure for both blog and default layouts. Contact is the only place where I found such behaviour.

avatar brianteeman
brianteeman - comment - 8 Oct 2024

Even if the intended behaviour is not to display these contacts the PR is obvioulsy not complete as you would surely need to update this as well.

<?php if ($item->published == 0) : ?>
<div>
<span class="list-published badge bg-warning text-light">
<?php echo Text::_('JUNPUBLISHED'); ?>
</span>
</div>
<?php endif; ?>
<?php if ($item->publish_up && strtotime($item->publish_up) > strtotime(Factory::getDate())) : ?>
<div>
<span class="list-published badge bg-warning text-light">
<?php echo Text::_('JNOTPUBLISHEDYET'); ?>
</span>
</div>
<?php endif; ?>
<?php if (!is_null($item->publish_down) && strtotime($item->publish_down) < strtotime(Factory::getDate())) : ?>
<div>
<span class="list-published badge bg-warning text-light">
<?php echo Text::_('JEXPIRED'); ?>
</span>
</div>
<?php endif; ?>
<?php if ($item->published == -2) : ?>
<div>
<span class="badge bg-warning text-light">
<?php echo Text::_('JTRASHED'); ?>
</span>
</div>
<?php endif; ?>

avatar HLeithner
HLeithner - comment - 15 Nov 2024

I think there are some bits missing, for example if the category is unpublished it shouldn't be shown.
Maybe check how it's done in com_content and replicate this to com_contact?

avatar HLeithner
HLeithner - comment - 15 Nov 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 15 Nov 2024
Title
Fix contact state filter for administrator
[5.2] Fix contact state filter for administrator
avatar HLeithner HLeithner - edited - 15 Nov 2024
avatar artur-stepien
artur-stepien - comment - 15 Nov 2024

I think there are some bits missing, for example if the category is unpublished it shouldn't be shown. Maybe check how it's done in com_content and replicate this to com_contact?

Unpublished items for administrators are shown in most of the core components. But only Contact had Trashed items visible too. The behaviour is copied from com_content in this PR. Only missing bit are changes in the view layout to not check for trashed state but I have no time this week for this.

Add a Comment

Login with GitHub to post a comment