From e23137653613d911e04467c96ff21c84d526a773 Mon Sep 17 00:00:00 2001
From: Reid 'arrdem' McKenzie <me@arrdem.com>
Date: Tue, 3 Oct 2023 00:04:34 -0600
Subject: [PATCH 1/2] Enable ignoring PRs by author

---
 projects/gh-unnotifier/src/python/ghunnotif/__main__.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/projects/gh-unnotifier/src/python/ghunnotif/__main__.py b/projects/gh-unnotifier/src/python/ghunnotif/__main__.py
index 4ea7a10..409214a 100644
--- a/projects/gh-unnotifier/src/python/ghunnotif/__main__.py
+++ b/projects/gh-unnotifier/src/python/ghunnotif/__main__.py
@@ -158,6 +158,7 @@ def maintain(config_path: Path, schedule: timedelta):
     client = Client(config["gh-unnotifier"]["api_key"])
     org_shitlist = config["gh-unnotifier"].get("org_shitlist", [])
     team_shitlist = config["gh-unnotifier"].get("team_shitlist", [])
+    author_shitlist = config["gh-unnotifier"].get("author_shitlist", [])
     user = client.get_user()
     user_teams = {it["slug"] for it in client.get_user_teams()}
     mark = savepoint = prev = None
@@ -178,6 +179,10 @@ def maintain(config_path: Path, schedule: timedelta):
             _resolve(notif, "Closed")
             return
 
+        if pr["user"]["login"] in author_shitlist:
+            _resolve(notif, "Ignoring PR by author")
+            return
+
         if notif["reason"] == "review_requested":
             reviewers = client.get_pr_reviewers(pr)
             if (
@@ -237,6 +242,7 @@ def maintain(config_path: Path, schedule: timedelta):
                 notif_timestamp = datetime.fromisoformat(notif["updated_at"])
                 if (mark - notif_timestamp).days > 3:
                     _resolve(notif, "More than 3 days old")
+                    continue
 
                 subject = notif["subject"]
 

From d497f166444064d47af10ae3eb1fc59976be0aaa Mon Sep 17 00:00:00 2001
From: Reid 'arrdem' McKenzie <me@arrdem.com>
Date: Tue, 3 Oct 2023 00:07:23 -0600
Subject: [PATCH 2/2] Enable ignoring issues by author ID

---
 .../gh-unnotifier/src/python/ghunnotif/__main__.py     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/projects/gh-unnotifier/src/python/ghunnotif/__main__.py b/projects/gh-unnotifier/src/python/ghunnotif/__main__.py
index 409214a..09254ac 100644
--- a/projects/gh-unnotifier/src/python/ghunnotif/__main__.py
+++ b/projects/gh-unnotifier/src/python/ghunnotif/__main__.py
@@ -224,6 +224,7 @@ def maintain(config_path: Path, schedule: timedelta):
 
     def _issue(subject, notif):
         issue = client.get_issue(url=subject["url"])
+
         if issue["state"] == "closed":
             comments = client.get_comments(url=issue["comments_url"])
             if not any(
@@ -231,6 +232,9 @@ def maintain(config_path: Path, schedule: timedelta):
             ):
                 _resolve(notif, "Unengaged issue closed")
 
+        if user["author"]["login"] in author_shitlist:
+            _resolve(notif, "Ignoring issue by author")
+
     while True:
         try:
             savepoint = prev
@@ -246,14 +250,14 @@ def maintain(config_path: Path, schedule: timedelta):
 
                 subject = notif["subject"]
 
-                match subject["type"]:
-                    case "PullRequest":
+                match subject["type"].lower():
+                    case "pullrequest":
                         _pr(subject, notif)
 
                     case "mention":
                         _mention(subject, notif)
 
-                    case "Issue":
+                    case "issue":
                         _issue(subject, notif)
 
             duration = (tick - datetime.now(timezone.utc)).total_seconds()