mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 15:21:24 +08:00
FIX: Disable Twitter onebox without API support (#17519)
Twitter removed OpenGraph tags from their pages. We can no longer extract all the information (for example, the quoted tweet) we need to render Oneboxes without using their API.
This commit is contained in:
@ -125,7 +125,13 @@ class TwitterApi
|
||||
def twitter_get(uri)
|
||||
request = Net::HTTP::Get.new(uri)
|
||||
request.add_field 'Authorization', "Bearer #{bearer_token}"
|
||||
http(uri).request(request).body
|
||||
response = http(uri).request(request)
|
||||
|
||||
if response.kind_of?(Net::HTTPTooManyRequests)
|
||||
Rails.logger.warn("Twitter API rate limit has been reached")
|
||||
end
|
||||
|
||||
response.body
|
||||
end
|
||||
|
||||
def authorization
|
||||
|
Reference in New Issue
Block a user