From a7e0aad089d4a047242d8f123254c780bcbeef3c Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Sat, 14 Oct 2017 16:07:11 +0200 Subject: [PATCH] Don't trigger several events when the same issue action is repeated; --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index 666aa67..0fb3eae 100644 --- a/index.js +++ b/index.js @@ -74,6 +74,8 @@ function conjugatePast(verb) { return verb + (verb.substr(-1) === 'e' ? '' : 'e') + 'd'; } +var lastIssueActions = {}; + var handlers = { push: function(body, say) { @@ -132,6 +134,11 @@ var handlers = { if (issue.action === 'update') return; + // Don't trigger several close event. + if (issue.action === lastIssueActions[issue.iid]) + return; + lastIssueActions[issue.iid] = issue.action; + var displayedAction = conjugatePast(issue.action); shortenURL(url, function(shortUrl) {