-
-
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): merge_request/approved and merge_request/unappr…
…oved (#34) * new gitlab events: merge_request/approved and merge_request/unapproved * removed unused consts * removed more unused consts * merge-request/approved: remove fields from embed & fix some strings * merge-request/unapproved: remove fields from embed & fix some strings
- Loading branch information
Showing
2 changed files
with
56 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,28 @@ | ||
const EventResponse = require('../EventResponse'); | ||
|
||
class MergeRequestApproved extends EventResponse { | ||
constructor(...args) { | ||
super(...args, { | ||
description: 'This event gets fired when a merge request is approved', | ||
}); | ||
} | ||
|
||
embed(data) { | ||
const mergeRequest = data.object_attributes; | ||
return { | ||
color: 0x149617, | ||
title: `Approved merge request #${mergeRequest.iid}: \`${mergeRequest.title}\``, | ||
}; | ||
} | ||
|
||
text(data) { | ||
const actor = data.user.name; | ||
const issue = data.object_attributes; | ||
return [ | ||
`🛠 **${actor}** approved merge request **#${issue.iid}** _${issue.title}_`, | ||
`<${issue.url}>`, | ||
].join('\n'); | ||
} | ||
} | ||
|
||
module.exports = MergeRequestApproved; |
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,28 @@ | ||
const EventResponse = require('../EventResponse'); | ||
|
||
class MergeRequestUnapproved extends EventResponse { | ||
constructor(...args) { | ||
super(...args, { | ||
description: 'This event gets fired when a merge request is unapproved', | ||
}); | ||
} | ||
|
||
embed(data) { | ||
const mergeRequest = data.object_attributes; | ||
return { | ||
color: 0x149617, | ||
title: `Unapproved merge request #${mergeRequest.iid}: \`${mergeRequest.title}\``, | ||
}; | ||
} | ||
|
||
text(data) { | ||
const actor = data.user.name; | ||
const issue = data.object_attributes; | ||
return [ | ||
`🛠 **${actor}** unapproved merge request **#${issue.iid}** _${issue.title}_`, | ||
`<${issue.url}>`, | ||
].join('\n'); | ||
} | ||
} | ||
|
||
module.exports = MergeRequestUnapproved; |