Skip to content

Commit

Permalink
Autoclear needinfo on expiring variant when closing its bug (#2397)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminmah committed May 22, 2024
1 parent dbb37b9 commit 37c1a6a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bugbot/rules/variant_expiration.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,15 @@ def handle_bug(self, bug, data):
"comment": {
"body": f"The variant has been removed from the [variants.yml]({VARIANTS_SEARCHFOX_URL}) file."
},
"flags": [
{
"id": flag_id,
"status": "X",
}
for flag_id in self.get_needinfo_ids(bug)
],
}

elif action == ExpirationAction.CLOSE_EXTENDED:
new_date = self.variants[variant_name]["expiration"].strftime("%Y-%m-%d")
self.autofix_changes[bugid] = {
Expand All @@ -312,7 +320,15 @@ def handle_bug(self, bug, data):
"comment": {
"body": f"The variant expiration date got extended to {new_date}",
},
"flags": [
{
"id": flag_id,
"status": "X",
}
for flag_id in self.get_needinfo_ids(bug)
],
}

elif action == ExpirationAction.NEEDINFO_TRIAGER:
self.ni_extra[bugid] = {
"has_patch": has_patch,
Expand All @@ -339,6 +355,14 @@ def handle_bug(self, bug, data):

return bug

def get_needinfo_ids(self, bug: dict) -> list[str]:
"""Get the IDs of the needinfo flags requested by the bot"""
return [
flag["id"]
for flag in bug.get("flags", [])
if flag["name"] == "needinfo" and flag["requestee"] == History.BOT
]

def is_with_patch(self, bug: dict) -> bool:
"""Check if the bug has a patch (not obsolete))"""
return any(
Expand Down

0 comments on commit 37c1a6a

Please sign in to comment.