mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Fix flaky twitter onebox behavior (#18141)
The order in which Onebox engines are loaded is not guaranteed. Occasionally during tests, the twitter engine would be loaded before the instagram engine, and cause the Instagram Onebox spec to fail due to the lack of `Onebox.options.twitter_client`. This commit makes the load order of Onebox engines consistent, and fixes the issue in the twitter_status_onebox.
This commit is contained in:
parent
2595e368b1
commit
2e00d4d024
|
@ -9,7 +9,7 @@ module Onebox
|
|||
def self.engines
|
||||
constants.select do |constant|
|
||||
constant.to_s =~ /Onebox$/
|
||||
end.map(&method(:const_get))
|
||||
end.sort.map(&method(:const_get))
|
||||
end
|
||||
|
||||
def self.all_iframe_origins
|
||||
|
|
|
@ -11,7 +11,8 @@ module Onebox
|
|||
always_https
|
||||
|
||||
def self.===(other)
|
||||
!Onebox.options.twitter_client.twitter_credentials_missing? && super
|
||||
client = Onebox.options.twitter_client
|
||||
client && !client.twitter_credentials_missing? && super
|
||||
end
|
||||
|
||||
def http_params
|
||||
|
|
Loading…
Reference in New Issue
Block a user