From d46b4e7470e3115df34fc96ba2f8e59974f713be Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Tue, 29 Oct 2024 18:12:20 -0300 Subject: Split PullRequestPage into different ScrollablePages --- kodereviewer/network_manager.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'kodereviewer/network_manager.py') diff --git a/kodereviewer/network_manager.py b/kodereviewer/network_manager.py index 089e69e..cbe5160 100644 --- a/kodereviewer/network_manager.py +++ b/kodereviewer/network_manager.py @@ -83,7 +83,14 @@ class NetworkManager(QObject): pull_request_number = int(match.groups()[0]) pull_request = self._project.find_pull_request(pull_request_number) if pull_request is not None: - pull_request.load_comments(response_body) + + # List + if reply.operation() == QNetworkAccessManager.Operation.GetOperation: + pull_request.load_comments(response_body) + elif reply.operation() == QNetworkAccessManager.Operation.PostOperation: + logger.info(response_body) + else: + logger.info("Pero la puta") elif (match := FILE_LIST_URL.search(reply.url().toString())): pull_request_number = int(match.groups()[0]) pull_request: Optional[PullRequest] = self._project.find_pull_request(pull_request_number) @@ -109,6 +116,16 @@ class NetworkManager(QObject): self._request_factory.createRequest(f'/issues/{number}/comments') ) + @Slot(int, str) + def createComment(self, number: int, comment: str) -> None: + request = self._request_factory.createRequest( + f'/issues/{number}/comments' + ) + data = { + 'body': comment + } + self._manager.post(request, json.dumps(data).encode()) + @Slot(int) def getFiles(self, pull_request_number) -> None: self._manager.get( -- cgit v1.2.3-70-g09d2