Refactor: Improve readabiliy

This commit is contained in:
syuilo 2017-02-01 04:07:30 +09:00
parent de70c4e9db
commit 5d306e64bb

View File

@ -29,15 +29,15 @@ module.exports = async (app: express.Application) => {
}); });
handler.on('issues', event => { handler.on('issues', event => {
const info = event.payload; const issue = event.payload.issue;
const action = event.payload.action;
let title: string; let title: string;
switch (info.action) { switch (action) {
case 'opened': title = 'Issueが立ちました'; break; case 'opened': title = 'Issueが立ちました'; break;
case 'closed': title = 'Issueが閉じられました'; break; case 'closed': title = 'Issueが閉じられました'; break;
case 'reopened': title = 'Issueが開きました'; break; case 'reopened': title = 'Issueが開きました'; break;
default: return; default: return;
} }
const text = `${title}: ${info.issue.number}${info.issue.title}\n${info.issue.html_url}`; post(`${title}: ${issue.number}${issue.title}\n${issue.html_url}`);
post(text);
}); });
}; };