DEV: allow to have duplicate topic titles if category is different (PR #10034)

GitHub

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Is there discussion about this on meta.discourse.org? Because the URL slugs would still be nearly identical, which is a bad thing, unless the category is in the slug

On Thu, Jun 11, 2020 at 2:08 PM CLAassistant notifications@github.com wrote:

[image: CLA assistant check] https://cla-assistant.io/discourse/discourse?pullRequest=10034 Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement https://cla-assistant.io/discourse/discourse?pullRequest=10034 before we can accept your contribution. You have signed the CLA already but the status is still pending? Let us recheck https://cla-assistant.io/check/discourse/discourse?pullRequest=10034 it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/discourse/discourse/pull/10034#issuecomment-642928864, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTWVIC6WUZU4TBO5WQA3DRWFBWHANCNFSM4N3YLL2A .

See https://meta.discourse.org/t/could-we-check-the-duplicated-topic-title-for-the-each-category-only/98790/6

Same is true if allow duplicate titles is completely turned on. So, the limitation on the different category would still be a improvement.

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/could-we-check-the-duplicated-topic-title-for-the-each-category-only/98790/7

The title of this pull request changed from “DEV: allow to have duplicate topic titles if categegory is different” to "DEV: allow to have duplicate topic titles if category is different

This breaks backwards compatibility because the boolean setting is now a string. Anyone who changed it will have a bool in the database.

At the very least we’ll need a migration to migrate the old setting to the new one.

We should also investigate if any plugins use the setting as that code will be broken too.

That’s true. Of course a migration can be added or would you prefer to have a new setting to configure this like: Allow duplicate titles in different categories

The secondary setting does seem much easier.

Yes, much easier but the naming of the setting and that a user knows how to switch which setting is more difficult. Any suggestion is highly appreciated :grinning:

Added a new setting.

Looks like the tests are failing because of another reason. Can you verfiy @eviltrout ?

    allow_duplicate_topic_titles_at_different_category: "Allow topics with identical, duplicate titles if the category is different. allow_duplicate_topic_titles must be false."
  allow_duplicate_topic_titles_category: false

This is a bit long. How about ^

All tests are finally green @eviltrout

Looks good now, thank you!