diff --git a/app/api/route/thread_api.rb b/app/api/route/thread_api.rb index 07d785438..2dbfc3af6 100644 --- a/app/api/route/thread_api.rb +++ b/app/api/route/thread_api.rb @@ -7,6 +7,7 @@ class ThreadApi < Base optional :issue_id, type: Integer, desc: 'ID of issue' optional :order_by, type: Symbol, values:%i( created_at id ), desc: 'Order of returned issues.' optional :order, type: Symbol, values:%i(asc desc), default: :asc + optional :external_service, type: String, desc: 'Filter by external service short name' end helpers do @@ -19,6 +20,7 @@ def post_or_get_thread end scope = scope.order(params[:order_by] => params[:order]) if params[:order_by] scope = scope.where(issue_id: params[:issue_id]) if params[:issue_id] + scope = scope.joins(:external_service).where('external_services.short_name' => params[:external_service]) if params[:external_service] scope = paginate scope end end