@@ -11,6 +11,7 @@ import type {
1111 PullRequest ,
1212 PullRequestReview ,
1313 PullRequestStateType ,
14+ StateType ,
1415 SubjectUser ,
1516 User ,
1617 WorkflowRunAttributes ,
@@ -36,15 +37,15 @@ export async function getGitifySubjectDetails(
3637 case 'CheckSuite' :
3738 return getGitifySubjectForCheckSuite ( notification ) ;
3839 case 'Commit' :
39- return getGitifySubjectForCommit ( notification ) ;
40+ return getGitifySubjectForCommit ( notification , settings ) ;
4041 case 'Discussion' :
4142 return await getGitifySubjectForDiscussion ( notification , settings ) ;
4243 case 'Issue' :
4344 return await getGitifySubjectForIssue ( notification , settings ) ;
4445 case 'PullRequest' :
4546 return await getGitifySubjectForPullRequest ( notification , settings ) ;
4647 case 'Release' :
47- return await getGitifySubjectForRelease ( notification ) ;
48+ return await getGitifySubjectForRelease ( notification , settings ) ;
4849 case 'WorkflowRun' :
4950 return getGitifySubjectForWorkflowRun ( notification ) ;
5051 default :
@@ -122,8 +123,15 @@ function getGitifySubjectForCheckSuite(
122123
123124async function getGitifySubjectForCommit (
124125 notification : Notification ,
126+ settings : SettingsState ,
125127) : Promise < GitifySubject > {
126128 let user : User ;
129+ const commitState : StateType = null ; // Commit notifications are stateless
130+
131+ // Return early if this notification would be hidden by filters
132+ if ( isStateFilteredOut ( commitState , settings ) ) {
133+ return null ;
134+ }
127135
128136 if ( notification . subject . latest_comment_url ) {
129137 const commitComment = (
@@ -143,7 +151,7 @@ async function getGitifySubjectForCommit(
143151 }
144152
145153 return {
146- state : null ,
154+ state : commitState ,
147155 user : getSubjectUser ( [ user ] ) ,
148156 } ;
149157}
@@ -373,13 +381,21 @@ export function parseLinkedIssuesFromPr(pr: PullRequest): string[] {
373381
374382async function getGitifySubjectForRelease (
375383 notification : Notification ,
384+ settings : SettingsState ,
376385) : Promise < GitifySubject > {
386+ const releaseState : StateType = null ; // Release notifications are stateless
387+
388+ // Return early if this notification would be hidden by filters
389+ if ( isStateFilteredOut ( releaseState , settings ) ) {
390+ return null ;
391+ }
392+
377393 const release = (
378394 await getRelease ( notification . subject . url , notification . account . token )
379395 ) . data ;
380396
381397 return {
382- state : null ,
398+ state : releaseState ,
383399 user : getSubjectUser ( [ release . author ] ) ,
384400 } ;
385401}
0 commit comments