From 70e1bf8d316f134d49e2edaee043a78d8b4bfb0b Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Tue, 21 May 2024 12:36:19 +0530 Subject: [PATCH] chore: cleanup --- .../v1/accounts/integrations/linear_controller.rb | 11 ----------- config/routes.rb | 1 - lib/integrations/linear/processor_service.rb | 11 ----------- lib/linear.rb | 14 -------------- lib/linear_mutations.rb | 14 -------------- lib/linear_queries.rb | 1 - 6 files changed, 52 deletions(-) diff --git a/app/controllers/api/v1/accounts/integrations/linear_controller.rb b/app/controllers/api/v1/accounts/integrations/linear_controller.rb index 9b5e57620..1d8840217 100644 --- a/app/controllers/api/v1/accounts/integrations/linear_controller.rb +++ b/app/controllers/api/v1/accounts/integrations/linear_controller.rb @@ -29,17 +29,6 @@ class Api::V1::Accounts::Integrations::LinearController < Api::V1::Accounts::Bas end end - def create_comment - issue_id = params[:issue_id] - comment = permitted_params[:comment] - issue = linear_processor_service.create_comment(issue_id, comment) - if issue.is_a?(Hash) && issue[:error] - render json: { error: issue[:error] }, status: :unprocessable_entity - else - render json: issue, status: :ok - end - end - def link_issue issue_id = params[:issue_id] issue = linear_processor_service.link_issue(conversation_link, issue_id) diff --git a/config/routes.rb b/config/routes.rb index f1675291b..20696fdee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -233,7 +233,6 @@ Rails.application.routes.draw do get :team_entities post :create_issue post :link_issue - post :create_comment post :unlink_issue get :search_issue get :linked_issue diff --git a/lib/integrations/linear/processor_service.rb b/lib/integrations/linear/processor_service.rb index 8c7747848..ab5c4f3c9 100644 --- a/lib/integrations/linear/processor_service.rb +++ b/lib/integrations/linear/processor_service.rb @@ -41,17 +41,6 @@ class Integrations::Linear::ProcessorService } end - def create_comment(issue_id, comment) - response = linear_client.create_comment(issue_id, comment) - - return response if response[:error] - - { - id: response['commentCreate']['comment']['id'], - body: response['commentCreate']['comment']['body'] - } - end - def unlink_issue(link_id) response = linear_client.unlink_issue(link_id) return response if response[:error] diff --git a/lib/linear.rb b/lib/linear.rb index f5abe6e27..804ea9e5e 100644 --- a/lib/linear.rb +++ b/lib/linear.rb @@ -66,20 +66,6 @@ class Linear process_response(response) end - def create_comment(issue_id, body) - raise ArgumentError, 'Missing issue id' if issue_id.blank? - raise ArgumentError, 'Missing body' if body.blank? - - variables = { - issueId: issue_id, - body: body - } - - mutation = LinearMutations.create_comment(variables) - response = post({ query: mutation }) - process_response(response) - end - def link_issue(link, issue_id) raise ArgumentError, 'Missing link' if link.blank? raise ArgumentError, 'Missing issue id' if issue_id.blank? diff --git a/lib/linear_mutations.rb b/lib/linear_mutations.rb index 912802cad..7f1715784 100644 --- a/lib/linear_mutations.rb +++ b/lib/linear_mutations.rb @@ -31,20 +31,6 @@ module LinearMutations GRAPHQL end - def self.create_comment(input) - <<~GRAPHQL - mutation { - commentCreate(input: { #{graphql_input(input)} }) { - success - comment { - id - body - } - } - } - GRAPHQL - end - def self.issue_link(issue_id, link) <<~GRAPHQL mutation { diff --git a/lib/linear_queries.rb b/lib/linear_queries.rb index d9da707c9..6f46abd6c 100644 --- a/lib/linear_queries.rb +++ b/lib/linear_queries.rb @@ -53,7 +53,6 @@ module LinearQueries id title description - identifier } } }