Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
fix: fallback to PD name if slack handle missing
Browse files Browse the repository at this point in the history
  • Loading branch information
nadade committed Feb 25, 2019
1 parent 278f418 commit d319fcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/pagerduty.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ function getEngineersOncallForHandover(scheduleId, escalationPolicyId, done) {
};
scheduleInfo.entries.forEach((entry) => {
const oncall = {
name: entry.user.name,
email: entry.user.email,
start: moment(entry.start),
end: moment(entry.end),
Expand Down
6 changes: 3 additions & 3 deletions src/reminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const slackApi = require('./slack-api');
const pagerduty = require('./pagerduty');

function formatMessageFromTemplate(templateText, data) {
const current = nconf.get(`slackUsers:${data.oncallEngineers.current.email}`);
const next = nconf.get(`slackUsers:${data.oncallEngineers.next.email}`);
const current = nconf.get(`slackUsers:${data.oncallEngineers.current.email}`) || data.oncallEngineers.current.name;
const next = nconf.get(`slackUsers:${data.oncallEngineers.next.email}`) || data.oncallEngineers.next.name;
const compiled = _.template(templateText);
const outputMessage = compiled({ current, next });
const outputMessage = compiled({ current, next, data });
debug('Reminder - formatMessage: ', outputMessage);
return outputMessage;
}
Expand Down

0 comments on commit d319fcb

Please sign in to comment.