Make list unique before saving it

Created on 5 April 2023, over 2 years ago
Updated 24 April 2023, over 2 years ago

Problem/Motivation

The blacklist is currently saved-as is. Duplicate entries are not removed.

I'd suggest to run https://www.php.net/manual/en/function.array-unique.php on the list before saving it, to erase duplicate entries. Duplicates simply make no sense and cost performance and time. Administrators shouldn't need to clean up by hands.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

  • Issue created by @Anybody
  • Assigned to Binoli Lalani
  • @binoli-lalani opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 2 years ago
  • 🇮🇳India Binoli Lalani Gujarat

    Hello,

    I removed duplicate email domains before saving the configuration form. I fixed it in MR. Please review.

    Thank you!

  • 🇩🇪Germany Anybody Porta Westfalica

    Thank you @Binoli Lalani that looks quite well already.

    I'm unsure, if it wouldn't perhaps make sense to use this change to no more store the patterns as string with linebreaks like in the form, but instead as array of strings and re-transform for the array...

    That would clean things up a bit, I guess. But a maintainer should decide.
    I'm talking about this area: https://git.drupalcode.org/issue/domain_registration-3352421/-/blob/8.x-...

    If you'd like to implement that change (incl. an update hook) I'ld suggest doing it in a separate MR so the maintainer can decide.

    Let's for now leave this "Needs review".

  • Status changed to Needs work over 2 years ago
  • 🇪🇸Spain pcambra Asturies

    I'm not sure we want to change this here, the only thing this MR should do is to clean duplicated patterns (as I understand the issue), right?

    Setting to NW.

  • 🇩🇪Germany Anybody Porta Westfalica

    Re #6 yes of course we can solve #5 in a follow-up!
    But would make sense to solve, wouldn't it?

  • 🇪🇸Spain pcambra Asturies

    I think preprocess on save and store the sanitized value makes a lot of sense :)

Production build 0.71.5 2024