Skip to content

Comments

[CMS PR 46325] Revert unrelated cs change and move include none logic#156

Closed
richard67 wants to merge 1 commit intoalikon:webservices-logic-and-for-tagsfrom
richard67:6.1-dev-pr-46325
Closed

[CMS PR 46325] Revert unrelated cs change and move include none logic#156
richard67 wants to merge 1 commit intoalikon:webservices-logic-and-for-tagsfrom
richard67:6.1-dev-pr-46325

Conversation

@richard67
Copy link

@richard67 richard67 commented Feb 14, 2026

Pull Request for joomla#46325 .

Summary of Changes

See my 2 still open review comments in the CMS PR.

Summary by Sourcery

Adjust article model filtering configuration and refine tag filter handling in the articles list query.

Bug Fixes:

  • Restrict the include-none (tag ID 0) handling to OR-mode tag filtering when building the articles list query.

Enhancements:

  • Tidy the article model filter field definitions for content listing.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 14, 2026

Reviewer's Guide

Refactors the content articles model by reformatting filter field definitions and relocating the tag include-none (tag=0) logic so it only applies to OR-mode tag filtering, reverting a previous broader change.

Class diagram for ArticlesModel tag filtering changes

classDiagram
    class ArticlesModel {
        +__construct(config, factory)
        +getListQuery() QueryInterface
        -configureFilterFields(config)
        -applyTagFilter(query, db, tag, tagMode)
    }

    class QueryInterface {
    }

    ArticlesModel ..> QueryInterface : returns
Loading

Flow diagram for includeNone tag logic in getListQuery

flowchart TD
    A[Start tag filtering] --> B{tag is array and not empty?}
    B -->|No| Z[Skip tag filter]
    B -->|Yes| C[Read tag_mode state]
    C --> D{tag_mode == 'all'?}

    D -->|Yes AND| E[Build AND-mode subquery without includeNone handling]
    E --> F[Apply AND-mode tag filter to main query]
    F --> Z

    D -->|No OR| G[Set includeNone to false]
    G --> H{Tag array contains 0?}
    H -->|Yes| I[Remove 0 from tag array using array_filter]
    I --> J[Set includeNone to true]
    H -->|No| K[Keep tag array as-is]
    J --> L[Build OR-mode subquery on #__contentitem_tag_map]
    K --> L
    L --> M[Apply OR-mode tag filter to main query]
    M --> N{includeNone is true?}
    N -->|Yes| O[Extend query to include items without tags]
    N -->|No| Z
    O --> Z[End tag filtering]
Loading

File-Level Changes

Change Details Files
Reformat filter_fields array definition for the articles model constructor without changing its semantics.
  • Condense the filter_fields array entries into a more compact, multi-key-per-line format
  • Keep the same set and order of filterable fields, including article, category, workflow, and featured fields
administrator/components/com_content/src/Model/ArticlesModel.php
Adjust tag filtering logic so the include-none tag handling is only applied for OR tag mode and revert the earlier generalized placement.
  • Remove pre-processing of the tag filter (including tag=0 handling) before tag_mode branching
  • Reintroduce tag=0 include-none handling inside the OR tag-mode branch only, using array_filter and a boolean includeNone flag
  • Ensure the subquery for tag filtering is built after the new includeNone handling in OR mode
administrator/components/com_content/src/Model/ArticlesModel.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The compressed filter_fields array format makes future diffs and maintenance harder to read; consider reverting to one entry per line to keep changes localized and easier to review.
  • In the tag OR-logic branch, after array_filter($tag) you might want to guard against an empty $tag array (e.g. early return or skip building the subquery) to avoid running an unnecessary query when only the 0 sentinel was provided.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The compressed `filter_fields` array format makes future diffs and maintenance harder to read; consider reverting to one entry per line to keep changes localized and easier to review.
- In the tag OR-logic branch, after `array_filter($tag)` you might want to guard against an empty `$tag` array (e.g. early return or skip building the subquery) to avoid running an unnecessary query when only the `0` sentinel was provided.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@richard67
Copy link
Author

Hmm, wait, I might have to fix that empty array thing.

@richard67
Copy link
Author

Closing as the moving of the none logic is false, so only the code style thing is remaining for which there is already a suggested change in the CMS PR.

@richard67 richard67 closed this Feb 14, 2026
@richard67 richard67 deleted the 6.1-dev-pr-46325 branch February 14, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant