Skip to content

Commit

Permalink
feat: add method for setting the needinfo flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Jun 3, 2022
1 parent 604c0ed commit b097be1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bugmon/bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,22 @@ def add_comment(self, comment: Comment) -> None:
raise TypeError("Method not supported when using a cached bug")
super().add_comment(comment)

def add_needinfo(self, user: str) -> bool:
"""Adds a needinfo request for the specified user.
:param user: The user to needinfo
"""
if "flags" not in self._bug:
self._bug["flags"] = []

request = {"name": "needinfo", "status": "?", "requestee": user}
for flag in self._bug["flags"]:
if request.items() < flag.items():
return False

self._bug["flags"].append(request)
return True

def diff(self) -> Dict[str, Union[str, Dict[str, Union[str, bool]]]]:
"""Overload Bug.diff() to strip attachments and comments"""
changed = cast(
Expand Down

0 comments on commit b097be1

Please sign in to comment.