mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-18 23:54:54 +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 |
||
|---|---|---|
| .. | ||
| templates | ||
| actions.rb | ||
| advanced_user_narrative.rb | ||
| base.rb | ||
| certificate_generator.rb | ||
| dice.rb | ||
| engine.rb | ||
| magic_8_ball.rb | ||
| new_user_narrative.rb | ||
| post_guardian_extension.rb | ||
| quote_generator.rb | ||
| store.rb | ||
| track_selector.rb | ||
| welcome_post_type_site_setting.rb | ||