Title search should only search selected content type

Created on 10 July 2023, over 1 year ago
Updated 19 May 2024, 6 months ago

Problem/Motivation

The title search is searching all content type's titles instead of only the selected content types.

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇺🇸United States 3cwebdev

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @3cwebdev
  • 🇮🇳India sarwan_verma

    I have fixed this issues

  • Status changed to Needs review about 1 year ago
  • 🇧🇪Belgium dieterholvoet Brussels

    The patch of @sarwan changes a bunch of unnecessary things. The patch of @3CWebDev fixes the issue in a simpler way. I was also wondering: wouldn't it make sense to only search the same content type as the current one for duplicates? I feel like content of different types isn't really supposed to be related. I added a patch implementing this.

  • 🇧🇪Belgium dieterholvoet Brussels

    Added a missing query condition.

  • 🇧🇪Belgium dieterholvoet Brussels

    Added another missing query condition.

  • Status changed to Needs work about 1 year ago
  • 🇳🇴Norway matsbla

    Thank you, but the patch needs to be rerolled

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Hi,

    I have rerolled patch #7, please review it.

    Thanks!

  • 🇮🇳India arisen Goa

    Thanks @mrinalini9 for the patch. Tested the patch #9 on 4.0.x branch.
    The patch applies cleanly.

    Checking patch src/Form/AntiDuplicatesFormAlter.php...
    Applied patch src/Form/AntiDuplicatesFormAlter.php cleanly.

    Reviewed the functionality. The patch makes sure the duplication check is done only on the selected content type.

    Steps used for testing:

    • Cloned the 4.0.x branch of the module on Drupal 10 installation.
    • Enabled the module
    • Created an Article with a specific title
    • Tried to create a Basic page with the same title. It shows the configured duplicate message
    • Applied the patch in #9.
    • Tried creating Basic page with the same title. It works fine
    • Tried creating an Article with the same name again. It shows the configured duplicate message

    RTBC for me.

  • Status changed to RTBC 10 months ago
  • 🇧🇪Belgium dieterholvoet Brussels

    I moved the latest patch to a MR. @matsbla can we get this merged? This is RTBC and conflicting with the changes from 🐛 Title search should exclude the current node Fixed .

  • Merge request !6Add 3373638-9.patch → (Open) created by dieterholvoet
  • Status changed to Needs work 7 months ago
  • 🇳🇴Norway matsbla

    I tested this, and when writing a title I now get this error in the log:

    Error: Call to a member function addCommand() on null in Drupal\anti_duplicates\Form\AntiDuplicatesFormAlter::duplicatesSearch() (line 76 of /var/lib/tugboat/stm/web/modules/contrib/anti_duplicates/src/Form/AntiDuplicatesFormAlter.php)

  • 🇧🇪Belgium dieterholvoet Brussels

    That's weird, I don't see a addCommand() call on line 76, do you? Are you sure you're testing with the MR on the dev release and no other patches are applied?

  • 🇳🇴Norway matsbla

    I will look over again, but please reroll the MR as 🐛 Title search should exclude the current node Fixed has been fixed now

  • Status changed to Needs review 6 months ago
  • 🇧🇪Belgium dieterholvoet Brussels

    Done!

  • Status changed to Needs work 6 months ago
  • 🇳🇴Norway matsbla

    I tested this now, and I get these errors:

    Error: Call to a member function getType() on null in Drupal\anti_duplicates\Form\AntiDuplicatesFormAlter::duplicatesSearch() (line 35 of /var/lib/tugboat/stm/web/modules/contrib/anti_duplicates/src/Form/AntiDuplicatesFormAlter.php)

    Warning: Undefined variable $currentNode in Drupal\anti_duplicates\Form\AntiDuplicatesFormAlter::duplicatesSearch() (line 35 of /var/lib/tugboat/stm/web/modules/contrib/anti_duplicates/src/Form/AntiDuplicatesFormAlter.php)

  • Status changed to Needs review 6 months ago
  • 🇧🇪Belgium dieterholvoet Brussels

    Are you sure you're applying the patch to the latest dev and not the last tagged release?

    • 748bce7b committed on 4.0.x
      Issue #3373638 by DieterHolvoet, 3CWebDev, mrinalini9, matsbla, arisen:...
  • Status changed to Fixed 6 months ago
  • 🇳🇴Norway matsbla

    Oh yes you are right, thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024