mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-13 21:01:16 +08:00
The `ChatwootApp.chatwoot_cloud?` gate on the platform banners route in #13943 reads `InstallationConfig` from the database. Because `routes.rb` is evaluated during `Rails.application.initialize!`, this ran before the database existed on a fresh setup, breaking `bundle exec rake db:create` in CI and first-time installs with `ActiveRecord::NoDatabaseError: We could not find your database: chatwoot_test`. The route is now always mounted, and the cloud check moved to where the database is guaranteed to be available — the controller (`before_action`) and the super admin sidebar partial. Closes the CI failure introduced by #13943. ## How to test 1. Drop your local databases: `bundle exec rake db:drop` 2. Run `bundle exec rake db:create` — it should succeed (previously failed with `NoDatabaseError`) 3. Bring the DB back: `bundle exec rake db:setup` 4. On a non-cloud install, visit `/super_admin/platform_banners` — should 404, and the sidebar entry should be hidden 5. With `DEPLOYMENT_ENV=cloud` configured (cloud install), the page and sidebar entry should work as before ## What changed - `config/routes.rb` — always mount `resources :platform_banners` (no DB call at boot) - `app/controllers/super_admin/platform_banners_controller.rb` — `before_action` raises `ActionController::RoutingError` (404) when not on Chatwoot Cloud - `app/views/super_admin/application/_navigation.html.erb` — hides the sidebar entry on non-cloud installs --------- Co-authored-by: Muhsin <12408980+muhsin-k@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| api | ||
| auth | ||
| concerns | ||
| devise_overrides | ||
| installation | ||
| linear | ||
| microsoft | ||
| notion | ||
| platform/api/v1 | ||
| public/api/v1 | ||
| shopify | ||
| super_admin | ||
| survey | ||
| tiktok | ||
| twilio | ||
| webhooks | ||
| android_app_controller.rb | ||
| api_controller.rb | ||
| apple_app_controller.rb | ||
| application_controller.rb | ||
| dashboard_controller.rb | ||
| health_controller.rb | ||
| microsoft_controller.rb | ||
| oauth_callback_controller.rb | ||
| platform_controller.rb | ||
| public_controller.rb | ||
| slack_uploads_controller.rb | ||
| swagger_controller.rb | ||
| widget_tests_controller.rb | ||
| widgets_controller.rb | ||