Example #1
0
 def _get_all_comments(self) -> List[PRComment]:
     self.__update()
     raw_comments = self._raw_pr["comments"]
     return [
         PagurePRComment(parent=self, raw_comment=comment_dict)
         for comment_dict in raw_comments
     ]
Example #2
0
    def comment(
        self,
        body: str,
        commit: Optional[str] = None,
        filename: Optional[str] = None,
        row: Optional[int] = None,
    ) -> "PRComment":
        payload: Dict[str, Any] = {"comment": body}
        if commit is not None:
            payload["commit"] = commit
        if filename is not None:
            payload["filename"] = filename
        if row is not None:
            payload["row"] = row

        self.__call_api("comment", method="POST", data=payload)
        self.__dirty = True
        return PagurePRComment(parent=self,
                               body=body,
                               author=self.project.service.user.get_username())
Example #3
0
    def pr_comment(
        self,
        pr_id: int,
        body: str,
        commit: str = None,
        filename: str = None,
        row: int = None,
    ) -> PRComment:
        payload: Dict[str, Any] = {"comment": body}
        if commit is not None:
            payload["commit"] = commit
        if filename is not None:
            payload["filename"] = filename
        if row is not None:
            payload["row"] = row

        self._call_project_api("pull-request",
                               str(pr_id),
                               "comment",
                               method="POST",
                               data=payload)

        return PagurePRComment(comment=body,
                               author=self.service.user.get_username())
Example #4
0
    def _get_all_pr_comments(self, pr_id: int) -> List[PRComment]:
        raw_comments = self._call_project_api("pull-request",
                                              str(pr_id))["comments"]

        return [PagurePRComment(comment_dict) for comment_dict in raw_comments]