Double entry in default watch list @ user preferences -> registration impossible

AI-generated summary

User rriemann reported a critical bug in Discourse version v1.5.0.beta7 +48 where accidentally entering the same category twice in the default watch list prevented new account creation due to a PG::UniqueViolation database error. rriemann resolved the immediate issue by manually removing the duplicate entry but noted that the system should prevent saving duplicate categories in the first place. codinghorror inquired about the version, noting that a unique table index fix had been deployed recently, while sam agreed that better guards against this buggy site setting were necessary. codinghorror requested a client-side check for duplicates be added to the task list. However, techAPJ could not reproduce the issue, demonstrating that the UI correctly prevented selecting the same category twice. Upon further investigation, rriemann concluded that the error was likely a leftover from a previous version, as the issue could not be reproduced in the current version with categories like “A Announcements” and “B Announcements”. The thread concluded with the understanding that the problem was resolved by the version update.

I run into the following issue:

By accident, I entered two times the same category into the default user preference field for the default watched categories.

Result: Accounts could not be created anymore

PG::UniqueViolation (ERROR: duplicate key value violates unique constraint "idx_category_users_u1" DETAIL: Key (user_id, category_id, notification_level)=(16, 11, 3) already exists. )

Solution: I removed the enry from the watch list so that the list was unique.

However, I would expect that Discourse doesn’t allow to add two times the same category to the watch list.

Best,
Robert

What version are you on? We fixed this about a week or two ago via a unique table index.

Yeah we should definitely guard against this buggy site setting a bit better.

The bug is that if you add “default watch” == “bug bug” we allow you to save it.

3 Likes

I’m on version v1.5.0.beta7 +48

Ok @techapj can you add this to your list? A client-side check for duplicates.

1 Like

I am not able to repro this issue. :confused:

Once I select a category from category list, I am not able to select the same category again (as expected).

Can you repro this here @rriemann? or on try.discourse.org?

I had category names like “A Announcements” and “B Announcements”. With the
Discourse version I stated above, I cannot reproduce this either. It must have
been a left over from a previous version, I guess. Now, the error message can
be googled with a solution, it should be fine. :slight_smile: