From a88655cd202dc43a64a7107f6f533bd386079386 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 21 Oct 2024 09:57:10 -0300 Subject: Add reviews view :D --- kodereviewer/network_manager.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'kodereviewer/network_manager.py') diff --git a/kodereviewer/network_manager.py b/kodereviewer/network_manager.py index 3296153..089e69e 100644 --- a/kodereviewer/network_manager.py +++ b/kodereviewer/network_manager.py @@ -18,6 +18,7 @@ PULL_REQUEST_LIST_URL = re.compile(r'/pulls$') COMMENT_LIST_URL = re.compile(r'/issues/(\d+)/comments') FILE_LIST_URL = re.compile(r'/pulls/(\d+)/files') CREATE_REVIEW_URL = re.compile(r'/pulls/(\d+)/reviews') +REVIEW_COMMENTS_URL = re.compile(r'/pulls/(\d+)/comments') logger = logging.getLogger(__name__) @@ -90,6 +91,11 @@ class NetworkManager(QObject): pull_request.load_files(response_body) elif (match := CREATE_REVIEW_URL.search(reply.url().toString())): logger.info(f'Got review reply: {response_body}') + elif (match := REVIEW_COMMENTS_URL.search(reply.url().toString())): + pull_request_number = int(match.groups()[0]) + pull_request: Optional[PullRequest] = self._project.find_pull_request(pull_request_number) + if pull_request is not None: + pull_request.load_reviews(response_body) else: logger.info(f"Can't handle {reply.url()}") @@ -111,6 +117,14 @@ class NetworkManager(QObject): ) ) + @Slot(int) + def getPullRequestReviews(self, pull_request_number: int) -> None: + self._manager.get( + self._request_factory.createRequest( + f'/pulls/{pull_request_number}/comments' + ) + ) + @Slot(int, str, str, str) def createReview( self, pull_request_number: str, commit_id: str, -- cgit v1.2.3-70-g09d2