mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +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:
parent
2b43238973
commit
626d50c15c
4 changed files with 68 additions and 111 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue