mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 01:06:53 +08:00
The discobot `quote` and `help` commands fetched a random quote from the external `api.forismatic.com` service for English locales. That host now returns HTTP 521, so `QuoteGenerator.generate` (which calls Excon with `expects: [200, 201]`) raised and crashed the `bot_input` job, leaving users with no reply. `roll` and `fortune` kept working because they run locally, and non-English locales were unaffected because they already used bundled quotes. This removes the external call entirely and samples from the locally bundled quotes for the user's effective locale — the same data already shipped for translations — so the commands work without any network dependency and can no longer fail silently. Sampling over every available quote also surfaces entries that the previous `rand(1..10)` never reached. Adds a `QuoteGenerator` unit spec and a `bot_input` job spec covering the no-network reply path and error propagation. Ref - t/184527 |
||
|---|---|---|
| .. | ||
| advanced_user_narrative_spec.rb | ||
| new_user_narrative_spec.rb | ||
| quote_generator_spec.rb | ||
| store_spec.rb | ||
| track_selector_spec.rb | ||