Change the behavior of MR signaling to be more quiet;

This commit is contained in:
Benjamin Bouvier 2017-06-28 10:45:16 +02:00
parent febab43948
commit 33c6458c97

View File

@ -126,20 +126,29 @@ var handlers = {
var url = request.url; var url = request.url;
var state = request.state; var state = request.state;
var assignee_id = request.assignee_id; if (typeof mergeRequests[id] === 'undefined') {
mergeRequests[id] = {
state: state
};
mergeRequests[id] = mergeRequests[id] || {}; // Stay silent if the merge request state is open and we didn't
var formerAssignee_id = mergeRequests[id].assignee_id; // know it before.
if (state === "opened") {
return;
}
} else {
var formerState = mergeRequests[id].state;
mergeRequests[id].state = state;
mergeRequests[id].assignee_id = assignee_id; // Abort if the state hasn't changed.
if (state === formerState) {
// Abort if just the assignee changed; return;
if (typeof formerAssignee_id !== 'undefined' && assignee_id !== formerAssignee_id) }
return; }
shortenURL(url, function(shortUrl) { shortenURL(url, function(shortUrl) {
var msg = projectName + ': merge request (' + from + '->' + to + ': ' + title + ') ' + var msg = projectName + ': MR# ' + id + ' (' + from + '->' + to + ': ' + title + ') ' +
'#' + id + ' changed state ("' + state + '"): ' + shortUrl; ' has been ' + state + '; ' + shortUrl;
say(msg); say(msg);
}); });
}, },