mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 03:57:24 +08:00

This commit fixes a bug in the "Dark Mode" checkbox in the interface user preferences where the checkbox state doesn't appear in the disabled state if the user disables dark mode. This happens because when rendering the checkbox, we check the relevant user options field within the controller's `init` method, but at that point in the controller's life cycle, the `user_option` object isn't available. What we should do instead is move this check to the route's `setupController` method where the `user_option` object is available and we can set the correct state on the controller. https://meta.discourse.org/t/-/349976 (private topic)