From 39c78662d0cf1b03c9da433c6489e93f0132ca80 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 3 Sep 2019 20:23:29 +0200 Subject: [PATCH] Fixed issue #2730: Registering of Twitter App fails for Twitter App with existing webhooks. --- app/controllers/external_credentials_controller.rb | 1 + lib/external_credential/twitter.rb | 2 +- lib/twitter_sync.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/external_credentials_controller.rb b/app/controllers/external_credentials_controller.rb index d7c7a9ad4..63ab17db1 100644 --- a/app/controllers/external_credentials_controller.rb +++ b/app/controllers/external_credentials_controller.rb @@ -26,6 +26,7 @@ class ExternalCredentialsController < ApplicationController def app_verify render json: { attributes: ExternalCredential.app_verify(params.permit!.to_h) }, status: :ok rescue => e + logger.error e render json: { error: e.message }, status: :ok end diff --git a/lib/external_credential/twitter.rb b/lib/external_credential/twitter.rb index 1a2f96e7a..5bc60dd8b 100644 --- a/lib/external_credential/twitter.rb +++ b/lib/external_credential/twitter.rb @@ -185,7 +185,7 @@ class ExternalCredential::Twitter # delete already registered webhooks webhooks.each do |webhook| - client.webhook_delete(webhook[:id]) + client.webhook_delete(webhook[:id], env_name) end # register new webhook diff --git a/lib/twitter_sync.rb b/lib/twitter_sync.rb index 9215e75a0..d382d754c 100644 --- a/lib/twitter_sync.rb +++ b/lib/twitter_sync.rb @@ -909,11 +909,11 @@ get all webhooks delete a webhooks client = TwitterSync.new - webhook_delete(webhook_id) + webhook_delete(webhook_id, env_name) =end - def webhook_delete(webhook_id) + def webhook_delete(webhook_id, env_name) Twitter::REST::Request.new(@client, :delete, "/1.1/account_activity/all/#{env_name}/webhooks/#{webhook_id}.json", {}).perform end