discourse/app
Alan Guo Xiang Tan 6bf0ac730f
FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field (#29776)
Firstly, we need to understand that ActiveRecord can be
connected to a role which prevent writes and this happens in Discourse when a
replica database has been setup for failover purposes. When a role
prevent writes from happening, ActiveRecord will raise the
`ActiveRecord::ReadOnlyError` if a write query is attempted.

Secondly, theme fields are baked at runtime within GET requests. The
baking process involves writing the baked value to the
`ThemeField#baked_value` column in the database.

If we combine the two points above, we can see how the writing of the
baked value to the database will trigger a `ActiveRecord::ReadOnlyError`
in a GET requests when the database is connected to a role preventing
writes. However, failing to bake a theme is not the end of the world and
should not cause GET requests to fail. Therefore, this commit adds a rescue
for `ActiveRecord::ReadOnlyError` in the `ThemeField#ensure_baked!`
method.
2024-11-15 10:19:10 +08:00
..
assets DEV: Fix duplicate port on livereload (#29771) 2024-11-14 23:05:47 +00:00
controllers FEATURE: Add skip notification option to group invite to topic (#29741) 2024-11-14 13:00:15 -03:00
helpers DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
jobs REVERT: Check for features sooner (#29746) 2024-11-13 11:30:34 -08:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
models FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field (#29776) 2024-11-15 10:19:10 +08:00
serializers UX: Split hide_profile_and_presence user option (#29632) 2024-11-12 22:22:58 -03:00
services UX: Split hide_profile_and_presence user option (#29632) 2024-11-12 22:22:58 -03:00
views UX: Change the authorize button color to primary (#29666) 2024-11-08 17:33:50 -05:00