mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
parent
124d1c30aa
commit
473c32d3d4
@ -42,16 +42,34 @@ from plane.utils.html_processor import strip_tags
|
|||||||
|
|
||||||
|
|
||||||
class ServiceIssueImportSummaryEndpoint(BaseAPIView):
|
class ServiceIssueImportSummaryEndpoint(BaseAPIView):
|
||||||
|
|
||||||
def get(self, request, slug, service):
|
def get(self, request, slug, service):
|
||||||
try:
|
try:
|
||||||
if service == "github":
|
if service == "github":
|
||||||
|
owner = request.GET.get("owner", False)
|
||||||
|
repo = request.GET.get("repo", False)
|
||||||
|
|
||||||
|
if not owner or not repo:
|
||||||
|
return Response(
|
||||||
|
{"error": "Owner and repo are required"},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
|
)
|
||||||
|
|
||||||
workspace_integration = WorkspaceIntegration.objects.get(
|
workspace_integration = WorkspaceIntegration.objects.get(
|
||||||
integration__provider="github", workspace__slug=slug
|
integration__provider="github", workspace__slug=slug
|
||||||
)
|
)
|
||||||
|
|
||||||
access_tokens_url = workspace_integration.metadata["access_tokens_url"]
|
access_tokens_url = workspace_integration.metadata.get(
|
||||||
owner = request.GET.get("owner")
|
"access_tokens_url", False
|
||||||
repo = request.GET.get("repo")
|
)
|
||||||
|
|
||||||
|
if not access_tokens_url:
|
||||||
|
return Response(
|
||||||
|
{
|
||||||
|
"error": "There was an error during the installation of the GitHub app. To resolve this issue, we recommend reinstalling the GitHub app."
|
||||||
|
},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
|
)
|
||||||
|
|
||||||
issue_count, labels, collaborators = get_github_repo_details(
|
issue_count, labels, collaborators = get_github_repo_details(
|
||||||
access_tokens_url, owner, repo
|
access_tokens_url, owner, repo
|
||||||
|
@ -113,7 +113,7 @@ def get_github_repo_details(access_tokens_url, owner, repo):
|
|||||||
last_url = labels_response.links.get("last").get("url")
|
last_url = labels_response.links.get("last").get("url")
|
||||||
parsed_url = urlparse(last_url)
|
parsed_url = urlparse(last_url)
|
||||||
last_page_value = parse_qs(parsed_url.query)["page"][0]
|
last_page_value = parse_qs(parsed_url.query)["page"][0]
|
||||||
total_labels = total_labels + 100 * (last_page_value - 1)
|
total_labels = total_labels + 100 * (int(last_page_value) - 1)
|
||||||
|
|
||||||
# Get labels in last page
|
# Get labels in last page
|
||||||
last_page_labels = requests.get(last_url, headers=headers).json()
|
last_page_labels = requests.get(last_url, headers=headers).json()
|
||||||
|
Loading…
Reference in New Issue
Block a user