Skip to content

Commit

Permalink
feat(gitlab: events): add wiki_page/update - fired when wiki page is …
Browse files Browse the repository at this point in the history
…updated
  • Loading branch information
dsevillamartin committed Apr 17, 2017
1 parent 308e38a commit 34870e8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/Gitlab/Events/wiki_page-update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const EventResponse = require('../EventResponse');

class WikiPageUpdate extends EventResponse {
constructor(...args) {
super(...args, {
description: 'This event is fired when a wiki page is updated',
});
}

embed(data) {
const page = data.object_attributes;
return {
color: 0x29BB9C,
title: `Updated wiki page \`${page.title}\``,
description: page.content,
};
}

text(data) {
const actor = data.user.name;
const page = data.object_attributes;
return [
`📰 **${actor}** updated wiki page **${page.title}**`,
` ${page.content.slice(0, 100).replace(/\n/g, ' ')}`,
`<${page.url}>`,
].join('\n');
}
}

module.exports = WikiPageUpdate;

0 comments on commit 34870e8

Please sign in to comment.