зеркало из https://github.com/mozilla/bugbot.git
[tracked_attention] Fix the reminder interval (#2200)
This commit is contained in:
Родитель
1a69975ab4
Коммит
f88559afab
|
@ -97,13 +97,19 @@ class TrackedAttention(BzCleaner):
|
|||
# If we commented before, we want to send reminders when we are close to
|
||||
# the soft freeze.
|
||||
is_reminder = bool(last_comment)
|
||||
if is_reminder and (
|
||||
self.is_weekend
|
||||
or not is_no_assignee
|
||||
or not self.is_soft_freeze_soon
|
||||
or last_comment["time"] > self.reminder_comment_date
|
||||
):
|
||||
return None
|
||||
if is_reminder:
|
||||
if self.is_weekend or not is_no_assignee or not self.is_soft_freeze_soon:
|
||||
return None
|
||||
|
||||
# Post reminders based on the configured interval
|
||||
last_reminder_comment = self._get_last_reminder_comment(bug)
|
||||
last_comment_time = (
|
||||
last_reminder_comment["time"]
|
||||
if last_reminder_comment
|
||||
else last_comment["time"]
|
||||
)
|
||||
if last_comment_time > self.reminder_comment_date:
|
||||
return None
|
||||
|
||||
bugid = str(bug["id"])
|
||||
|
||||
|
@ -280,6 +286,17 @@ class TrackedAttention(BzCleaner):
|
|||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _get_last_reminder_comment(bug: dict) -> Optional[dict]:
|
||||
"""Get the the last comment generated by this rule"""
|
||||
for comment in reversed(bug["comments"]):
|
||||
if comment["author"] == History.BOT and comment["text"].startswith(
|
||||
"This is a reminder regarding"
|
||||
):
|
||||
return comment
|
||||
|
||||
return None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
TrackedAttention().run()
|
||||
|
|
Загрузка…
Ссылка в новой задаче