discourse/plugins/chat/lib
David Taylor 54cae1299e
DEV: Do not attempt to overwrite UserOption enums during autoloading (#22150)
Unfortunately, Discourse's `UserOption` model is not currently autoloaded. That means that modifying it via a `reloadable_patch` will try to apply the changes repeatedly. Normally this doesn't matter since the changes are idempotent. However, introducing ActiveRecord enums is not idempotent - they raise an error if the same enum already exists on the model. This commit adds a check to avoid hitting this 'duplicate definition' error.

Reproduced

```
rails runner 'Rails.application.reloader.reload!'
```
2023-06-16 12:29:32 +01:00
..
chat DEV: Do not attempt to overwrite UserOption enums during autoloading (#22150) 2023-06-16 12:29:32 +01:00
discourse_dev DEV: Reintroduce chat rake dev generate tasks (#21164) 2023-04-20 10:53:10 +10:00
email_controller_helper
onebox/templates UX: update chat icon to d-chat (#20744) 2023-03-21 10:40:42 -04:00
tasks DEV: Reintroduce chat rake dev generate tasks (#21164) 2023-04-20 10:53:10 +10:00
service_runner.rb DEV: Add policy objects to services 2023-05-25 12:34:00 +02:00