chore: update link issue API
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class Api::V1::Accounts::Integrations::LinearController < Api::V1::Accounts::BaseController
|
||||
before_action :fetch_conversation, only: [:link_issue]
|
||||
|
||||
def teams
|
||||
teams = linear_processor_service.teams
|
||||
if teams.is_a?(Hash) && teams[:error]
|
||||
@@ -28,9 +30,8 @@ class Api::V1::Accounts::Integrations::LinearController < Api::V1::Accounts::Bas
|
||||
end
|
||||
|
||||
def link_issue
|
||||
link = params[:link]
|
||||
issue_id = params[:issue_id]
|
||||
issue = linear_processor_service.link_issue(link, issue_id)
|
||||
issue = linear_processor_service.link_issue(conversation_link, issue_id)
|
||||
if issue.is_a?(Hash) && issue[:error]
|
||||
render json: { error: issue[:error] }, status: :unprocessable_entity
|
||||
else
|
||||
@@ -76,11 +77,19 @@ class Api::V1::Accounts::Integrations::LinearController < Api::V1::Accounts::Bas
|
||||
|
||||
private
|
||||
|
||||
def conversation_link
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/conversations/#{@conversation.display_id}"
|
||||
end
|
||||
|
||||
def fetch_conversation
|
||||
@conversation = Current.account.conversations.find_by!(display_id: permitted_params[:conversation_id])
|
||||
end
|
||||
|
||||
def linear_processor_service
|
||||
Integrations::Linear::ProcessorService.new(account: Current.account)
|
||||
end
|
||||
|
||||
def permitted_params
|
||||
params.permit(:team_id, :link, :issue_id, :link_id, :title, :description, :assignee_id, :priority, label_ids: [])
|
||||
params.permit(:team_id, :conversation_id, :issue_id, :link_id, :title, :description, :assignee_id, :priority, label_ids: [])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user