FIX: these are not spe and dont have response.parsed_body
This commit is contained in:
parent
d483f4ae5a
commit
d5808f4e9a
|
@ -64,7 +64,7 @@ module DiscourseChat
|
|||
if !response.kind_of?(Net::HTTPSuccess)
|
||||
error_key = nil
|
||||
begin
|
||||
responseData = response.parsed_body
|
||||
responseData = JSON.parse(response.body)
|
||||
if responseData['errcode'] == "M_UNKNOWN_TOKEN"
|
||||
error_key = 'chat_integration.provider.matrix.errors.unknown_token'
|
||||
elsif responseData['errcode'] == "M_UNKNOWN"
|
||||
|
|
|
@ -125,7 +125,7 @@ module DiscourseChat::Provider::SlackProvider
|
|||
raise ::DiscourseChat::ProviderError.new info: { request: uri, response_code: response.code, response_body: response.body }
|
||||
end
|
||||
|
||||
json = response.parsed_body
|
||||
json = JSON.parse(response.body)
|
||||
|
||||
unless json["ok"] == true
|
||||
if json.key?("error") && (json["error"] == ('channel_not_found') || json["error"] == ('is_archived'))
|
||||
|
|
|
@ -208,7 +208,7 @@ module DiscourseChat::Provider::SlackProvider
|
|||
req.set_form_data(token: SiteSetting.chat_integration_slack_access_token, limit: 200, cursor: cursor)
|
||||
response = http.request(req)
|
||||
return false unless response.kind_of? Net::HTTPSuccess
|
||||
json = response.parsed_body
|
||||
json = JSON.parse(response.body)
|
||||
return false unless json['ok']
|
||||
cursor = json['response_metadata']['next_cursor']
|
||||
json['members'].each do |user|
|
||||
|
@ -244,7 +244,7 @@ module DiscourseChat::Provider::SlackProvider
|
|||
req.set_form_data(data)
|
||||
response = http.request(req)
|
||||
return false unless response.kind_of? Net::HTTPSuccess
|
||||
json = response.parsed_body
|
||||
json = JSON.parse(response.body)
|
||||
return false unless json['ok']
|
||||
|
||||
raw_messages = json['messages']
|
||||
|
|
|
@ -44,7 +44,7 @@ module DiscourseChat
|
|||
req.body = message.to_json
|
||||
response = http.request(req)
|
||||
|
||||
responseData = response.parsed_body
|
||||
responseData = JSON.parse(response.body)
|
||||
|
||||
responseData
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue