mirror of
https://github.com/discourse/discourse.git
synced 2026-07-31 08:38:27 -05:00
In certain cases, chat channels may have empty slugs, it happens when: 1. The `slug_generation_method` setting is set to `None` 2. `slug_generation_method` is set to `ASCII` and a channel with a Unicode name and an empty slug is created (in this case, the code that creates channels tries to generate a slug and fallbacks to an empty slug) At the moment, we have a unique index on the `chat_channels.slug` column which leads to errors when creating several channels with empty slugs (Discourse is able to create one such channel, but when trying to create the second one fails because of the unique constraint). This PR fixes that by adding a `where` condition to the index. Slugs still have to be unique, but now many channels may have empty slugs. This fix is similar to the one we made to the category slugs – https://github.com/discourse/discourse/commit/7ba914f1e10d90b1e4d25b0ab2427c94df456eae.