Skip to content

Commit

Permalink
Skip unfreeze if no freeze comment found
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
bkeepers committed Aug 29, 2017
1 parent f87c9ba commit a29eaa1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = robot => {
context.github.issues.getComments(githubHelper.parseCommentURL(issue.comments_url)).then(resp => {
return freeze.getLastFreeze(resp.data);
}).then(lastFreezeComment => {
if (freeze.unfreezable(lastFreezeComment)) {
if (lastFreezeComment && freeze.unfreezable(lastFreezeComment)) {
freeze.unfreeze(issue, formatParser.propFromComment(lastFreezeComment));
}
});
Expand Down
10 changes: 2 additions & 8 deletions lib/freeze.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,9 @@ module.exports = class Freeze {
}

getLastFreeze(comments) {
let mainComment = {};
comments.reverse().some(comment => {
if (comment.user.login === this.config.probotUsername) {
mainComment = comment;
return true;
}
return false;
return comments.reverse().find(comment => {
return comment.user.login === this.config.probotUsername;
});
return mainComment;
}

freeze(context, props) {
Expand Down

0 comments on commit a29eaa1

Please sign in to comment.