summaryrefslogtreecommitdiff
path: root/kodereviewer/network_manager.py
diff options
context:
space:
mode:
authorMatias Linares <matias@deprecated.org>2024-10-21 09:57:10 -0300
committerMatias Linares <matias.linares@comprandoengrupo.net>2024-10-29 18:11:18 -0300
commita88655cd202dc43a64a7107f6f533bd386079386 (patch)
treeae6038d67657aa5bf1c18f2e2d1e6dc0bb1558ac /kodereviewer/network_manager.py
parentd349e5014fc60a8ae140a56c457c3f3258959582 (diff)
downloadkodereviewer-a88655cd202dc43a64a7107f6f533bd386079386.tar.gz
Add reviews view :D
Diffstat (limited to 'kodereviewer/network_manager.py')
-rw-r--r--kodereviewer/network_manager.py14
1 files changed, 14 insertions, 0 deletions
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,