Simplify handling of MRs updates;

This commit is contained in:
Benjamin Bouvier 2017-06-28 12:13:12 +02:00
parent 90440224ac
commit 90245819af
1 changed files with 3 additions and 20 deletions

View File

@ -37,8 +37,6 @@ var client = new irc.Client(config.server, config.nick, {
retryDelay: 120000
});
var mergeRequests = {};
var app = express();
app.use(bodyParser.json()); // for parsing application/json
@ -137,24 +135,9 @@ var handlers = {
var url = request.url;
var state = request.state;
if (typeof mergeRequests[id] === 'undefined') {
mergeRequests[id] = {
state: state
};
// Stay silent if the merge request state is open and we didn't
// know it before.
if (state === "opened") {
return;
}
} else {
var formerState = mergeRequests[id].state;
mergeRequests[id].state = state;
// Abort if the state hasn't changed.
if (state === formerState) {
return;
}
// Don't trigger the hook on mr's updates.
if (request.action === 'update') {
return;
}
shortenURL(url, function(shortUrl) {