Skip to content

fix: update search result display logic - #70

Merged
omg-xtao merged 1 commit into
NextAlone:devfrom
Parsa307:disable-search-ads
Jul 24, 2026
Merged

fix: update search result display logic#70
omg-xtao merged 1 commit into
NextAlone:devfrom
Parsa307:disable-search-ads

Conversation

@Parsa307

@Parsa307 Parsa307 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

if hide sponsored messages is enabled it won't hide search ads, this pr would solve it.

Summary by Sourcery

Bug Fixes:

  • Hide sponsored search ads when the user has enabled the hide sponsored messages option.

@sourcery-ai

sourcery-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a configuration-based check to prevent loading sponsored search ads when the global "hide sponsored messages" option is enabled, integrating NekoConfig into the dialogs search adapter sponsored query logic.

Sequence diagram for hiding sponsored search ads based on NekoConfig

sequenceDiagram
    actor User
    participant DialogsSearchAdapter
    participant NekoConfig
    participant ConnectionsManager

    User->>DialogsSearchAdapter: searchDialogs(text, folderId, allowPublicPosts)
    DialogsSearchAdapter->>ConnectionsManager: cancelRequest(sponsoredReqId, true)
    DialogsSearchAdapter->>NekoConfig: hideSponsoredMessage.Bool()
    alt hideSponsoredMessage.Bool() is true
        DialogsSearchAdapter-->DialogsSearchAdapter: sponsoredQuery = null
    else hideSponsoredMessage.Bool() is false
        DialogsSearchAdapter-->DialogsSearchAdapter: [other conditions on query and premium]
        alt conditions fail
            DialogsSearchAdapter-->DialogsSearchAdapter: sponsoredQuery = null
        else conditions pass
            DialogsSearchAdapter-->DialogsSearchAdapter: create TL_contacts_getSponsoredPeers
        end
    end
Loading

File-Level Changes

Change Details Files
Integrate NekoConfig flag into the dialogs search sponsored results logic to disable search ads when hiding sponsored messages is enabled.
  • Import NekoConfig into DialogsSearchAdapter so configuration flags are available in search logic.
  • Extend the sponsored peers request gating condition to short-circuit when hideSponsoredMessage is true, preventing sponsoredQuery from being set.
  • Preserve existing checks based on query length, premium status, and MessagesController sponsored disable state while adding the new configuration condition.
TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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 combined condition in the if statement mixes || and &&; consider adding explicit parentheses around the premium/sponsored-disabled clause to make the logic easier to read and less error-prone.
  • Directly referencing NekoConfig from DialogsSearchAdapter increases coupling; consider routing this configuration through an existing controller or configuration layer instead of importing it directly into the adapter.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The combined condition in the `if` statement mixes `||` and `&&`; consider adding explicit parentheses around the premium/sponsored-disabled clause to make the logic easier to read and less error-prone.
- Directly referencing `NekoConfig` from `DialogsSearchAdapter` increases coupling; consider routing this configuration through an existing controller or configuration layer instead of importing it directly into the adapter.

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.

@omg-xtao omg-xtao added the bug Something isn't working label Jul 24, 2026
@omg-xtao omg-xtao changed the title fix: hide search ads fix: update search result display logic Jul 24, 2026
@omg-xtao
omg-xtao merged commit 95b6de0 into NextAlone:dev Jul 24, 2026
5 checks passed
@Parsa307
Parsa307 deleted the disable-search-ads branch July 24, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants