Skip to content

Commit

Permalink
chore: refactor returns and ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
KeesCBakker committed Aug 29, 2023
1 parent b9b3bbf commit 14a74a5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/scripts/pagerduty-webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = function (robot) {
if (pagerEndpoint && pagerRoom) {
robot.router.post(pagerEndpoint, function (req, res) {
robot.messageRoom(pagerRoom, parseWebhook(req, res));
return res.end();
res.end();
return;
});
}

Expand Down Expand Up @@ -42,15 +43,16 @@ module.exports = function (robot) {
return returnMessage.join('\n');
};

const getUserForIncident = function (incident) {
function getUserForIncident(incident) {
if (incident.assigned_to_user) {
return incident.assigned_to_user.email;
} else if (incident.resolved_by_user) {
}
if (incident.resolved_by_user) {
return incident.resolved_by_user.email;
} else {
return '(???)';
}
};

return '(???)';
}

return (generateIncidentString = function (incident, hookType) {
console.log('hookType is ' + hookType);
Expand Down

0 comments on commit 14a74a5

Please sign in to comment.