From 9fa6bde0c088b39a23f92209494eef56e43ef9e8 Mon Sep 17 00:00:00 2001
From: Magnus Therning <magnus@therning.org>
Date: Sat, 9 Mar 2024 15:11:12 +0100
Subject: [PATCH 1/2] Make the subject URL optional

This goes against the documentation at
https://docs.github.com/en/rest/activity/notifications but it seems to be
required in order to handle certain types of notifications.
---
 src/GitHub/Data/Activities.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs
index e03986dc..850b7445 100644
--- a/src/GitHub/Data/Activities.hs
+++ b/src/GitHub/Data/Activities.hs
@@ -26,7 +26,7 @@ instance FromJSON RepoStarred where
 
 data Subject = Subject
     { subjectTitle :: !Text
-    , subjectURL :: !URL
+    , subjectURL :: !(Maybe URL)
     , subjectLatestCommentURL :: !(Maybe URL)
     -- https://developer.github.com/v3/activity/notifications/ doesn't indicate
     -- what the possible values for this field are.

From c377abba74e62496c5adb1bfd81ce33cce7dfa71 Mon Sep 17 00:00:00 2001
From: maralorn <mail@maralorn.de>
Date: Tue, 24 Sep 2024 23:37:17 +0200
Subject: [PATCH 2/2] Add new Notification reasons

---
 src/GitHub/Data/Activities.hs | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs
index 850b7445..540241c8 100644
--- a/src/GitHub/Data/Activities.hs
+++ b/src/GitHub/Data/Activities.hs
@@ -46,13 +46,18 @@ instance FromJSON Subject where
         <*> o .: "type"
 
 data NotificationReason
-    = AssignReason
+    = ApprovalRequestedReason
+    | AssignReason
     | AuthorReason
     | CommentReason
+    | CiActivityReason
     | InvitationReason
     | ManualReason
+    | MemberFeatureRequestedReason
     | MentionReason
     | ReviewRequestedReason
+    | SecurityAlertReason
+    | SecurityAdvisoryCreditReason
     | StateChangeReason
     | SubscribedReason
     | TeamMentionReason
@@ -63,17 +68,22 @@ instance Binary NotificationReason
 
 instance FromJSON NotificationReason where
     parseJSON = withText "NotificationReason" $ \t -> case T.toLower t of
-        "assign"           -> pure AssignReason
-        "author"           -> pure AuthorReason
-        "comment"          -> pure CommentReason
-        "invitation"       -> pure InvitationReason
-        "manual"           -> pure ManualReason
-        "mention"          -> pure MentionReason
-        "review_requested" -> pure ReviewRequestedReason
-        "state_change"     -> pure StateChangeReason
-        "subscribed"       -> pure SubscribedReason
-        "team_mention"     -> pure TeamMentionReason
-        _                  -> fail $ "Unknown NotificationReason " ++ show t
+      "approval_requested"       -> pure ApprovalRequestedReason
+      "assign"                   -> pure AssignReason
+      "author"                   -> pure AuthorReason
+      "comment"                  -> pure CommentReason
+      "ci_activity"              -> pure CiActivityReason
+      "invitation"               -> pure InvitationReason
+      "manual"                   -> pure ManualReason
+      "member_feature_requested" -> pure MemberFeatureRequestedReason
+      "mention"                  -> pure MentionReason
+      "review_requested"         -> pure ReviewRequestedReason
+      "security_alert"           -> pure SecurityAlertReason
+      "security_advisory_credit" -> pure SecurityAdvisoryCreditReason
+      "state_change"             -> pure StateChangeReason
+      "subscribed"               -> pure SubscribedReason
+      "team_mention"             -> pure TeamMentionReason
+      _                          -> fail $ "Unknown NotificationReason " ++ show t
 
 data Notification = Notification
     -- XXX: The notification id field type IS in fact string. Not sure why gh