Don't trigger several events when the same issue action is repeated;
This commit is contained in:
parent
dec545136b
commit
a7e0aad089
7
index.js
7
index.js
@ -74,6 +74,8 @@ function conjugatePast(verb) {
|
|||||||
return verb + (verb.substr(-1) === 'e' ? '' : 'e') + 'd';
|
return verb + (verb.substr(-1) === 'e' ? '' : 'e') + 'd';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lastIssueActions = {};
|
||||||
|
|
||||||
var handlers = {
|
var handlers = {
|
||||||
|
|
||||||
push: function(body, say) {
|
push: function(body, say) {
|
||||||
@ -132,6 +134,11 @@ var handlers = {
|
|||||||
if (issue.action === 'update')
|
if (issue.action === 'update')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Don't trigger several close event.
|
||||||
|
if (issue.action === lastIssueActions[issue.iid])
|
||||||
|
return;
|
||||||
|
lastIssueActions[issue.iid] = issue.action;
|
||||||
|
|
||||||
var displayedAction = conjugatePast(issue.action);
|
var displayedAction = conjugatePast(issue.action);
|
||||||
|
|
||||||
shortenURL(url, function(shortUrl) {
|
shortenURL(url, function(shortUrl) {
|
||||||
|
Loading…
Reference in New Issue
Block a user