forked from github/plane
parent
124d1c30aa
commit
473c32d3d4
@ -42,16 +42,34 @@ from plane.utils.html_processor import strip_tags
|
||||
|
||||
|
||||
class ServiceIssueImportSummaryEndpoint(BaseAPIView):
|
||||
|
||||
def get(self, request, slug, service):
|
||||
try:
|
||||
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(
|
||||
integration__provider="github", workspace__slug=slug
|
||||
)
|
||||
|
||||
access_tokens_url = workspace_integration.metadata["access_tokens_url"]
|
||||
owner = request.GET.get("owner")
|
||||
repo = request.GET.get("repo")
|
||||
access_tokens_url = workspace_integration.metadata.get(
|
||||
"access_tokens_url", False
|
||||
)
|
||||
|
||||
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(
|
||||
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")
|
||||
parsed_url = urlparse(last_url)
|
||||
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
|
||||
last_page_labels = requests.get(last_url, headers=headers).json()
|
||||
|
Loading…
Reference in New Issue
Block a user