in bugbot/rules/perfalert_resolved_regression.py [0:0]
def get_resolution_comment(self, comments, bug_history):
status_time = bug_history["status_time"]
resolution_comment, preceding_comment = self.get_resolution_comments(
comments, status_time
)
if (
resolution_comment
and resolution_comment["author"] == bug_history["status_author"]
):
# Accept if status author provided a comment at the same time
return resolution_comment["text"]
if preceding_comment:
if preceding_comment["author"] == bug_history["status_author"]:
# Accept if status author provided a comment before setting
# resolution
return preceding_comment["text"]
preceding_resolution_comment = f"{preceding_comment['text']} (provided by {preceding_comment['author']})"
if any(
keyword in preceding_comment["text"].lower()
for keyword in RESOLUTION_KEYWORDS
):
# Accept if a non-status author provided a comment before a
# resolution was set, and hit some keywords
return preceding_resolution_comment
if (
lmdutils.get_timestamp(status_time)
- lmdutils.get_timestamp(preceding_comment["creation_time"])
) < self.max_seconds_before_status:
# Accept if the previous comment from another author is
# within the time limit
return preceding_resolution_comment
return None