diff --git a/package.json b/package.json index dbfb103..bc4c881 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "font-awesome": "^4.4.0", "http-server": "^0.9.0", "lodash": "^3.9.1", - "parse-github-event": "^0.2.0", "prop-types": "^15.5.10", "react": "^0.14.3", "react-dom": "^0.14.3", diff --git a/src/js/util.js b/src/js/util.js index e121eb5..ae09f17 100644 --- a/src/js/util.js +++ b/src/js/util.js @@ -1,47 +1,9 @@ 'use strict'; var _ = require('lodash'); -var githubEvent = require('parse-github-event'); var twitterText = require('twitter-text'); -const isVisibleGithubEvent = ({type}) => type !== 'PushEvent' && type !== 'DeleteEvent'; - module.exports = { - github(items) { - return items.filter(isVisibleGithubEvent).map((item) => { - - _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; - - var template = _.template(githubEvent.parse(item).text); - - var repository = `https://github.com/${item.repo.name}`; - var branch; - if(item.payload.ref) { - branch = item.payload.ref.replace('refs/heads/', ''); - } - - var message = template({ - repository: `${item.repo.name}`, - branch: branch, - number: item.payload.number, - ref_type: item.payload.ref_type, - ref: item.payload.ref - }); - - var url = `https://github.com/${item.actor.login}`; - - return { - user: item.actor.login, - userLink: url, - image: item.actor.avatar_url, - imageLink: url, - body: message, - timestamp: new Date(item.created_at), - url: message.url, - type: 'github' - }; - }); - }, twitter(items) { return items.map((item) => { if(item.retweeted) {