This commit is contained in:
mrT23
2024-07-05 16:51:35 +03:00
parent 78bcb72205
commit 7fc41409d4

View File

@ -144,9 +144,8 @@ class PRCodeSuggestions:
update_header=True, update_header=True,
name="suggestions", name="suggestions",
final_update_message = final_update_message, final_update_message = final_update_message,
max_previous_comments = get_settings().pr_code_suggestions.max_history_len) max_previous_comments = get_settings().pr_code_suggestions.max_history_len,
if self.progress_response: progress_response = self.progress_response)
self.progress_response.delete()
else: else:
if self.progress_response: if self.progress_response:
@ -174,7 +173,8 @@ class PRCodeSuggestions:
update_header: bool = True, update_header: bool = True,
name='review', name='review',
final_update_message=True, final_update_message=True,
max_previous_comments=4): max_previous_comments=4,
progress_response=None):
history_header = f"#### Previous suggestions\n" history_header = f"#### Previous suggestions\n"
last_commit_num = self.git_provider.get_latest_commit_url().split('/')[-1][:7] last_commit_num = self.git_provider.get_latest_commit_url().split('/')[-1][:7]
latest_suggestion_header = f"Latest suggestions up to {last_commit_num}" latest_suggestion_header = f"Latest suggestions up to {last_commit_num}"
@ -242,7 +242,10 @@ class PRCodeSuggestions:
pr_comment_updated += f"{prev_suggestion_table}\n" pr_comment_updated += f"{prev_suggestion_table}\n"
get_logger().info(f"Persistent mode - updating comment {comment_url} to latest {name} message") get_logger().info(f"Persistent mode - updating comment {comment_url} to latest {name} message")
if progress_response: # publish to 'progress_response' comment, because it refreshes immediately
comment.delete()
self.git_provider.edit_comment(progress_response, pr_comment_updated)
else:
self.git_provider.edit_comment(comment, pr_comment_updated) self.git_provider.edit_comment(comment, pr_comment_updated)
return return
except Exception as e: except Exception as e: