@@ -16,7 +16,7 @@ import { getMonthlyDownloadCount } from "./util/npm";
1616import { client } from "./graphql-client" ;
1717import { ApolloQueryResult } from "apollo-boost" ;
1818import { fetchFile as defaultFetchFile } from "./util/fetchFile" ;
19- import { noNulls , notUndefined , findLast , forEachReverse , daysSince , authorNotBot , latestDate , earliestDate
19+ import { noNulls , notUndefined , findLast , forEachReverse , daysSince , sameUser , authorNotBot , latestDate , earliestDate
2020 } from "./util/util" ;
2121import * as HeaderParser from "definitelytyped-header-parser" ;
2222import * as jsonDiff from "fast-json-patch" ;
@@ -211,7 +211,7 @@ export async function deriveStateForPR(
211211 const lastBlessing = getLastMaintainerBlessingDate ( prInfo . timelineItems ) ;
212212 const reopenedDate = getReopenedDate ( prInfo . timelineItems ) ;
213213 const now = getNow ( ) . toISOString ( ) ;
214- const reviews = getReviews ( prInfo , isOwner ) ;
214+ const reviews = getReviews ( prInfo ) ;
215215 const latestReview = latestDate ( ...reviews . map ( r => r . date ) ) ;
216216 const firstApprovalDate = earliestDate ( ...reviews . map ( r => r . type === "approved" ? r . date : undefined ) ) ;
217217 const stalenessInDays = daysSince ( latestDate ( createdDate , lastPushDate , lastCommentDate , lastBlessing , reopenedDate , latestReview ) || lastPushDate , now ) ;
@@ -253,10 +253,6 @@ export async function deriveStateForPR(
253253 function botNoPackages ( pr_number : number ) : BotNoPackages {
254254 return { type : "no_packages" , pr_number } ;
255255 }
256-
257- function isOwner ( login : string ) {
258- return pkgInfo . some ( p => p . owners ?. some ( k => k . toLowerCase ( ) === login . toLowerCase ( ) ) ) ;
259- }
260256}
261257
262258type ReopenedEvent = PR_repository_pullRequest_timelineItems_nodes_ReopenedEvent ;
@@ -436,7 +432,7 @@ function usersSayReadyToMerge(comments: PR_repository_pullRequest_comments_nodes
436432 && ( new Date ( comment . createdAt ) ) . getTime ( ) > sinceDate . getTime ( ) ) ;
437433}
438434
439- function getReviews ( prInfo : PR_repository_pullRequest , isOwner : ( name : string ) => boolean ) {
435+ function getReviews ( prInfo : PR_repository_pullRequest ) {
440436 if ( ! prInfo . reviews ?. nodes ) return [ ] ;
441437 const headCommitOid : string = prInfo . headRefOid ;
442438 const reviews : ReviewInfo [ ] = [ ] ;
@@ -448,7 +444,7 @@ function getReviews(prInfo: PR_repository_pullRequest, isOwner: (name: string) =
448444 // Skip self-reviews
449445 if ( reviewer === prInfo . author ! . login ) continue ;
450446 // Only look at the most recent review per person (ignoring pending/commented)
451- if ( reviews . find ( r => r . reviewer . toLowerCase ( ) === reviewer . toLowerCase ( ) ) ) continue ;
447+ if ( reviews . find ( r => sameUser ( r . reviewer , reviewer ) ) ) continue ;
452448 // collect reviews by type
453449 if ( r . commit . oid !== headCommitOid ) {
454450 reviews . push ( { type : "stale" , reviewer, date, abbrOid : r . commit . abbreviatedOid } ) ;
0 commit comments