Correctly conjugate action verb for merge requests too;

This commit is contained in:
Benjamin Bouvier 2017-09-20 12:41:07 +02:00
parent 3410be5d5c
commit 98d28f8154

View File

@ -69,6 +69,11 @@ if (config.lstu) {
};
}
function conjugatePast(verb) {
// Make action displayable (e.g., open -> opened, close -> closed, merge -> merged).
return verb + (verb.substr(-1) === 'e' ? '' : 'e') + 'd';
}
var handlers = {
push: function(body, say) {
@ -127,8 +132,7 @@ var handlers = {
if (issue.action === 'update')
return;
// Make action displayable (e.g., open -> opened, close -> closed, merge -> merged).
var displayedAction = issue.action + (issue.action.substr(-1) === 'e' ? '' : 'e') + 'd';
var displayedAction = conjugatePast(issue.action);
shortenURL(url, function(shortUrl) {
var msg = user + ' ' + displayedAction + ' issue #' + issueNumber + ' ("' + issueTitle + '") on ' + projectName + ' ' + shortUrl;
@ -156,8 +160,10 @@ var handlers = {
return;
}
var displayedAction = conjugatePast(request.action);
shortenURL(url, function(shortUrl) {
var msg = user + ' ' + request.action + 'd MR !' + id + ' (' + from + '->' + to + ': ' + title + ') ' +
var msg = user + ' ' + displayedAction + ' MR !' + id + ' (' + from + '->' + to + ': ' + title + ') ' +
' on ' + projectName + '; ' + shortUrl;
say(msg);
});