Skip to content

Commit

Permalink
feat(gitlab: events): add note/issue - fired when someone comments on…
Browse files Browse the repository at this point in the history
… issue
  • Loading branch information
dsevillamartin committed Apr 15, 2017
1 parent 214389e commit 13fcf70
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/Gitlab/Events/note-issue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const EventResponse = require('../EventResponse');

class NoteIssue extends EventResponse {
constructor(...args) {
super(...args, {
description: 'This event gets fired when someone comments on an issue',
});
}

embed(data) {
const comment = data.object_attributes;
const issue = data.issue;
return {
color: `#996633`,
title: `Commented on issue #${issue.iid}: \`${issue.title}\``,
description: comment.note,
};
}

text(data) {
const actor = data.user.name;
const comment = data.object_attributes;
const issue = data.issue;
return [
`**${actor}** commented on issue **#${issue.iid}** _${issue.title}_`,
` ${comment.note.slice(0, 100).replace(/\n/g, '\n ')}`,
`${comment.url}`,
].join('\n');
}
}

module.exports = NoteIssue;

0 comments on commit 13fcf70

Please sign in to comment.