azure fix

This commit is contained in:
mrT23
2024-07-11 18:21:21 +03:00
parent 6135bf1f53
commit 734a027702
3 changed files with 33 additions and 5 deletions

View File

@ -130,6 +130,18 @@ class AzureDevopsProvider(GitProvider):
def get_pr_description_full(self) -> str:
return self.pr.description
def delete_comment(self, comment):
try:
self.azure_devops_client.delete_comment(
repository_id=self.repo_slug,
pull_request_id=self.pr_num,
thread_id=comment.thread_id,
comment_id=comment.id,
project=self.workspace_slug,
)
except Exception as e:
get_logger().exception(f"Failed to delete comment, error: {e}")
def edit_comment(self, comment, body: str):
try:
self.azure_devops_client.update_comment(
@ -525,10 +537,18 @@ class AzureDevopsProvider(GitProvider):
def get_user_id(self):
return 0
def get_issue_comments(self):
raise NotImplementedError(
"Azure DevOps provider does not support issue comments yet"
)
threads = self.azure_devops_client.get_threads(repository_id=self.repo_slug, pull_request_id=self.pr_num, project=self.workspace_slug)
threads.reverse()
comment_list = []
for thread in threads:
for comment in thread.comments:
if comment.content and comment not in comment_list:
comment.body = comment.content
comment.thread_id = thread.id
comment_list.append(comment)
return comment_list
def add_eyes_reaction(self, issue_comment_id: int, disable_eyes: bool = False) -> Optional[int]:
return True

View File

@ -193,6 +193,9 @@ class GitProvider(ABC):
def get_comment_url(self, comment) -> str:
return ""
def delete_comment(self, comment):
comment.delete()
#### labels operations ####
@abstractmethod
def publish_labels(self, labels):