-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gitlab: events): add note/issue - fired when someone comments on…
… issue
- Loading branch information
1 parent
214389e
commit 13fcf70
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |