Skip to content

Commit d3ced54

Browse files
strugeeHainish
authored andcommitted
Ignore edits to issues predating the bot (EFForg#13460)
1 parent 99b126b commit d3ced54

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

utils/issue-format-bot/lib/issueedit.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const parse = require('./parse'),
77
labeler = require('./labeler'),
88
_ = require('lodash');
99

10+
// We do this outside the event handler to avoid setting up and tearing down this object each time a hook is received
11+
const botStartDate = new Date('2018-09-25');
12+
1013
// TODO make this share more with newissue.js?
1114

1215
module.exports = function(robot, alexa) {
@@ -20,6 +23,12 @@ module.exports = function(robot, alexa) {
2023
return;
2124
}
2225

26+
const createdAt = new Date(context.payload.issue.created_at);
27+
if (createdAt <= botStartDate) {
28+
robot.log('Ignoring event for a legacy, pre-bot issue.');
29+
return;
30+
}
31+
2332
const data = parse(context.payload.issue.body);
2433

2534
// Check if the data is problematic

utils/issue-format-bot/test/labeler-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function resetSpies(context) {
3737
}
3838

3939
function addLabelsCalledOnce(err, context) {
40-
assert.ok(context.github.issues.addLabels.calledOnce);
40+
assert.isTrue(context.github.issues.addLabels.calledOnce);
4141
}
4242

4343
function assertWhichLabel(label) {

0 commit comments

Comments
 (0)