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 state = request.state;
var assignee_id = request.assignee_id;
if (typeof mergeRequests[id] === 'undefined') {
mergeRequests[id] = {
state: state
};
mergeRequests[id] = mergeRequests[id] || {};
var formerAssignee_id = mergeRequests[id].assignee_id;
mergeRequests[id].assignee_id = assignee_id;
// Abort if just the assignee changed;
if (typeof formerAssignee_id !== 'undefined' && assignee_id !== formerAssignee_id)
// 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;
}
}
shortenURL(url, function(shortUrl) {
var msg = projectName + ': merge request (' + from + '->' + to + ': ' + title + ') ' +
'#' + id + ' changed state ("' + state + '"): ' + shortUrl;
var msg = projectName + ': MR# ' + id + ' (' + from + '->' + to + ': ' + title + ') ' +
' has been ' + state + '; ' + shortUrl;
say(msg);
});
},