Change the behavior of MR signaling to be more quiet;
This commit is contained in:
parent
febab43948
commit
33c6458c97
29
index.js
29
index.js
@ -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;
|
||||
// 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;
|
||||
|
||||
mergeRequests[id].assignee_id = assignee_id;
|
||||
|
||||
// Abort if just the assignee changed;
|
||||
if (typeof formerAssignee_id !== 'undefined' && assignee_id !== formerAssignee_id)
|
||||
return;
|
||||
// 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);
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user