File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -736,6 +736,35 @@ describe('utils/subject.ts', () => {
736736 } ) ;
737737 } ) ;
738738
739+ it ( 'avoid fetching comments if latest_comment_url and url are the same' , async ( ) => {
740+ mockNotification . subject . latest_comment_url =
741+ mockNotification . subject . url ;
742+
743+ nock ( 'https://api.github.com' )
744+ . get ( '/repos/gitify-app/notifications-test/pulls/1' )
745+ . reply ( 200 , {
746+ state : 'open' ,
747+ draft : false ,
748+ merged : false ,
749+ user : mockAuthor ,
750+ } ) ;
751+
752+ const result = await getGitifySubjectDetails (
753+ mockNotification ,
754+ mockAccounts . token ,
755+ ) ;
756+
757+ expect ( result ) . toEqual ( {
758+ state : 'open' ,
759+ user : {
760+ login : mockAuthor . login ,
761+ html_url : mockAuthor . html_url ,
762+ avatar_url : mockAuthor . avatar_url ,
763+ type : mockAuthor . type ,
764+ } ,
765+ } ) ;
766+ } ) ;
767+
739768 it ( 'handle pull request without latest_comment_url' , async ( ) => {
740769 mockNotification . subject . latest_comment_url = null ;
741770
Original file line number Diff line number Diff line change @@ -224,7 +224,10 @@ async function getGitifySubjectForPullRequest(
224224
225225 let prCommentUser : User ;
226226
227- if ( notification . subject . latest_comment_url ) {
227+ if (
228+ notification . subject . latest_comment_url &&
229+ notification . subject . latest_comment_url !== notification . subject . url
230+ ) {
228231 const prComment = (
229232 await getIssueOrPullRequestComment (
230233 notification . subject . latest_comment_url ,
You can’t perform that action at this time.
0 commit comments