diff --git a/app/controllers/api/v1/accounts/integrations/github_controller.rb b/app/controllers/api/v1/accounts/integrations/github_controller.rb new file mode 100644 index 000000000..6f29a4c70 --- /dev/null +++ b/app/controllers/api/v1/accounts/integrations/github_controller.rb @@ -0,0 +1,12 @@ +class Api::V1::Accounts::Integrations::GithubController < Api::V1::Accounts::BaseController + before_action :fetch_hook, only: [:destroy] + + def destroy + @hook.destroy! + head :ok + end + + def fetch_hook + @hook = Integrations::Hook.where(account: Current.account).find_by(app_id: 'github') + end +end diff --git a/app/javascript/dashboard/i18n/locale/en/integrations.json b/app/javascript/dashboard/i18n/locale/en/integrations.json index dca1d056f..deae9353a 100644 --- a/app/javascript/dashboard/i18n/locale/en/integrations.json +++ b/app/javascript/dashboard/i18n/locale/en/integrations.json @@ -21,7 +21,13 @@ "PLACEHOLDER": "Enter your Github Client ID", "HELP": "Enter your Github Client ID", "CANCEL": "Cancel", - "SUBMIT": "Connect" + "SUBMIT": "Connect", + "DELETE": { + "TITLE": "Are you sure you want to delete the integration?", + "MESSAGE": "Are you sure you want to delete the integration?", + "CONFIRM": "Yes, delete", + "CANCEL": "Cancel" + } }, "HEADER": "Integrations", "DESCRIPTION": "Chatwoot integrates with multiple tools and services to improve your team's efficiency. Explore the list below to configure your favorite apps.", @@ -329,6 +335,7 @@ } } }, + "CAPTAIN": { "NAME": "Captain", "HEADER_KNOW_MORE": "Know more", diff --git a/config/routes.rb b/config/routes.rb index 5ffcc4c66..4d08423ca 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -258,6 +258,11 @@ Rails.application.routes.draw do get :linked_issues end end + resource :github, controller: 'github', only: [] do + collection do + delete :destroy + end + end end resources :working_hours, only: [:update]