From 0e08520c0c2f13f79920b68ea9174b0a77564f95 Mon Sep 17 00:00:00 2001 From: "Hussam.lawen" Date: Sun, 11 Feb 2024 13:21:59 +0200 Subject: [PATCH] match pr-pro --- pr_agent/git_providers/github_provider.py | 6 +++--- pr_agent/git_providers/gitlab_provider.py | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index 07f808db..375e46ec 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -381,6 +381,9 @@ class GithubProvider(GitProvider): get_logger().error(f"Failed to publish code suggestion, error: {e}") return False + def edit_comment(self, comment, body: str): + comment.edit(body=body) + def remove_initial_comment(self): try: for comment in getattr(self.pr, 'comments_list', []): @@ -395,9 +398,6 @@ class GithubProvider(GitProvider): except Exception as e: get_logger().exception(f"Failed to remove comment, error: {e}") - def edit_comment(self, comment, body: str): - comment.edit(body=body) - def get_title(self): return self.pr.title diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index edb7d095..5c1cf8e9 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -179,11 +179,7 @@ class GitLabProvider(GitProvider): return comment def edit_comment(self, comment, body: str): - try: - comment.body = body - comment.save() - except Exception as e: - get_logger().exception(f"Failed to edit comment, error: {e}") + self.mr.notes.update(comment.id,{'body': body} ) def publish_inline_comment(self, body: str, relevant_file: str, relevant_line_in_file: str): edit_type, found, source_line_no, target_file, target_line_no = self.search_line(relevant_file,