Skip to content

Commit 7331a35

Browse files
committed
wip
1 parent d1a4ac6 commit 7331a35

File tree

4 files changed

+31
-84
lines changed

4 files changed

+31
-84
lines changed

functions/src/github.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -273,33 +273,35 @@ async function paginate<S extends PageParams, T>(
273273
fn: GitHubFn<S, Array<T>>,
274274
options: S
275275
): Promise<T[]> {
276-
const per_page = 100;
277-
let pagesRemaining = true;
278-
let page = 0;
279-
280-
let allData = [] as T[];
281-
while (pagesRemaining) {
282-
page++;
283-
284-
// Merge pagination options with the options passed in
285-
const pageOptions = Object.assign(
286-
{
287-
per_page,
288-
page
289-
},
290-
options
291-
);
292-
293-
const res = await fn(pageOptions);
294-
allData = allData.concat(res.data);
295-
296-
// We assume another page remaining if we got exactly as many
297-
// issues as we asked for.
298-
pagesRemaining = res.data.length == per_page;
299-
300-
// Wait 0.5s between pages
301-
await util.delay(0.5);
302-
}
276+
return this.api.paginate(options);
277+
278+
// const per_page = 100;
279+
// let pagesRemaining = true;
280+
// let page = 0;
281+
282+
// let allData = [] as T[];
283+
// while (pagesRemaining) {
284+
// page++;
285+
286+
// // Merge pagination options with the options passed in
287+
// const pageOptions = Object.assign(
288+
// {
289+
// per_page,
290+
// page
291+
// },
292+
// options
293+
// );
294+
295+
// const res = await fn(pageOptions);
296+
// allData = allData.concat(res.data);
297+
298+
// // We assume another page remaining if we got exactly as many
299+
// // issues as we asked for.
300+
// pagesRemaining = res.data.length == per_page;
301+
302+
// // Wait 0.5s between pages
303+
// await util.delay(0.5);
304+
// }
303305

304-
return allData;
306+
// return allData;
305307
}

functions/src/issues.ts

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -241,59 +241,6 @@ export class IssueHandler {
241241
actions.push(...this.markNeedsTriage(repo, issue));
242242
}
243243

244-
// Filter spam from b/378634578. This can be removed in the future.
245-
const spamWords = [
246-
"pemain",
247-
"paybis",
248-
"cracked version",
249-
"xnxx",
250-
"sex@videos",
251-
"inatogel",
252-
"ao vivo",
253-
["cracktel.com"],
254-
["therealhax.net"],
255-
["## [", "download", "/dl/"],
256-
["changelly", "crypto"],
257-
["telegram leak"],
258-
["call +1", "contact"],
259-
["safepal", "support"],
260-
["recover", "account", "1-866-"],
261-
["1-866-409-9289"],
262-
["robinhood", "support"],
263-
["blockchain", "support"],
264-
["blogspot.com"],
265-
["wordpress.com/wp-content"],
266-
["situs", "slot"],
267-
["jogos", "direto"],
268-
["jogos", "directo"],
269-
["video viral", "x twitter"]
270-
];
271-
const issueContent = ` ${issue.title} ${issue.body || ""} `.toLowerCase();
272-
// Scope spam filtering to affected repos only.
273-
const isAffectedRepo = org == "firebase";
274-
const isSpam =
275-
isAffectedRepo &&
276-
spamWords.find(wordOrArray => {
277-
if (Array.isArray(wordOrArray)) {
278-
return wordOrArray.every(word => issueContent.includes(word));
279-
} else {
280-
const wordWithSpace = ` ${wordOrArray} `;
281-
return issueContent.includes(wordWithSpace);
282-
}
283-
});
284-
285-
if (isSpam) {
286-
// Discard other actions, wipe and lock the issue, and block
287-
// the offending user.
288-
const reason = `Issue is believed to be spam: ${issue.title}`;
289-
// Disabled for now. Can be re-enabled if spam reoccurs in the future.
290-
// return [
291-
// new types.GitHubSpamAction(org, name, issue.number, reason),
292-
// new types.GitHubBlockAction(org, issue.user.login),
293-
// new types.GitHubLockAction(org, name, issue.number)
294-
// ];
295-
}
296-
297244
// Check if it matches the template. This feature is implicitly enabled by
298245
// the template having "matchable" structure so there is no need to check
299246
// the repo's configuration.

functions/src/test/stale-issues-test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ describe("Stale issue handler", async () => {
265265
DEFAULT_CONFIG
266266
);
267267

268-
console.log(actions);
269-
270268
util.actionsListEqual(actions, [
271269
new types.GitHubCommentAction(
272270
"firebase",

functions/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ export namespace github {
461461
milestone: Milestone;
462462
locked: boolean;
463463
comments: number;
464-
pull_request: boolean;
464+
pull_request: PullRequest;
465465
closed_at?: string;
466466
created_at: string;
467467
updated_at: string;

0 commit comments

Comments
 (0)