main ← incorrectly-delete-custom-palettes
opened 04:57AM - 03 Nov 25 UTC
When installing a new theme, custom color palettes (with theme_id = nil) were be…ing incorrectly deleted. This occurred because the theme installation process called `update_theme_color_schemes` before the new theme was persisted to the database.
Since the theme's ID was nil, the query
`ColorScheme.unscoped.where(theme_id: nil)` would match ALL custom color schemes, causing them to be deleted during the cleanup phase.
Bug introduced in this PR - https://github.com/discourse/discourse/pull/34722