forked from olabiniV2/repo-notifications-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventHandler_issue_comment.js
27 lines (23 loc) · 1.06 KB
/
eventHandler_issue_comment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const a = require('./eventAccessors.js');
module.exports = (e, {subjectFormatter: sf, messageFormatter: mf}) => {
let subject = '';
let message = '';
switch(e.action) {
case 'created':
subject = `${sf.format_front(e, a)} created a new comment on issue ${sf.format_issue(e, a)}`;
message = `${mf.format_front(e, a)} created a new ${mf.format_link(a.comment_url(e), 'comment')} on issue ${mf.format_issue(e, a)}.`;
break;
case 'edited':
subject = `${sf.format_front(e, a)} changed a comment on issue ${sf.format_issue(e, a)}`;
message = `${mf.format_front(e, a)} changed a ${mf.format_link(a.comment_url(e), 'comment')} on issue ${mf.format_issue(e, a)}.`;
break;
case 'deleted':
subject = `${sf.format_front(e, a)} removed a comment on issue ${sf.format_issue(e, a)}`;
message = `${mf.format_front(e, a)} removed a ${mf.format_link(a.comment_url(e), 'comment')} on issue ${mf.format_issue(e, a)}.`;
break;
}
return {
subject: subject,
message: message,
};
};