Skip to content

Commit 37c1a6a

Browse files
authored
Autoclear needinfo on expiring variant when closing its bug (#2397)
1 parent dbb37b9 commit 37c1a6a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

bugbot/rules/variant_expiration.py

+24
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,15 @@ def handle_bug(self, bug, data):
303303
"comment": {
304304
"body": f"The variant has been removed from the [variants.yml]({VARIANTS_SEARCHFOX_URL}) file."
305305
},
306+
"flags": [
307+
{
308+
"id": flag_id,
309+
"status": "X",
310+
}
311+
for flag_id in self.get_needinfo_ids(bug)
312+
],
306313
}
314+
307315
elif action == ExpirationAction.CLOSE_EXTENDED:
308316
new_date = self.variants[variant_name]["expiration"].strftime("%Y-%m-%d")
309317
self.autofix_changes[bugid] = {
@@ -312,7 +320,15 @@ def handle_bug(self, bug, data):
312320
"comment": {
313321
"body": f"The variant expiration date got extended to {new_date}",
314322
},
323+
"flags": [
324+
{
325+
"id": flag_id,
326+
"status": "X",
327+
}
328+
for flag_id in self.get_needinfo_ids(bug)
329+
],
315330
}
331+
316332
elif action == ExpirationAction.NEEDINFO_TRIAGER:
317333
self.ni_extra[bugid] = {
318334
"has_patch": has_patch,
@@ -339,6 +355,14 @@ def handle_bug(self, bug, data):
339355

340356
return bug
341357

358+
def get_needinfo_ids(self, bug: dict) -> list[str]:
359+
"""Get the IDs of the needinfo flags requested by the bot"""
360+
return [
361+
flag["id"]
362+
for flag in bug.get("flags", [])
363+
if flag["name"] == "needinfo" and flag["requestee"] == History.BOT
364+
]
365+
342366
def is_with_patch(self, bug: dict) -> bool:
343367
"""Check if the bug has a patch (not obsolete))"""
344368
return any(

0 commit comments

Comments
 (0)