-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created filters for comments and authors (#6)
Added filters to ignore issues that have no comments or that come from a particular author. Abstracted the code for the filters to be in an external method, as the evaluation of such filters. This resolves #2 and resolves #3
- Loading branch information
Showing
8 changed files
with
127 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import moment from "moment"; | ||
|
||
export const olderThanDays = (issue: IssueData, daysStale: number): boolean => { | ||
return moment().diff(moment(issue.updated_at), "days") > daysStale; | ||
} | ||
|
||
export const byNoComments = (issue: IssueData): boolean => { | ||
return issue.comments === 0; | ||
} | ||
|
||
export const isNotFromAuthor = ({ user }: IssueData, authors: string[]): boolean => { | ||
return authors.some(author => author.toLowerCase() === user?.login.toLowerCase()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
declare global { | ||
interface IssueData { | ||
html_url: string; | ||
title: string; | ||
created_at: string; | ||
updated_at: string; | ||
number: number; | ||
comments: number; | ||
/** If user was deleted it is going to be null */ | ||
user: { login: string } | null | ||
} | ||
|
||
interface Repo { | ||
owner: string, | ||
repo: string; | ||
} | ||
|
||
interface Filters { | ||
noComments?: boolean; | ||
daysStale: number; | ||
notFromAuthor: string[]; | ||
} | ||
} | ||
|
||
export { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters