mirror of
https://github.com/koodiklinikka/koodiklinikka.fi.git
synced 2026-02-16 17:53:30 +00:00
remove github PushEvents from feed
This commit is contained in:
@@ -26,7 +26,7 @@ module.exports = React.createClass({
|
||||
.then((res) => {
|
||||
|
||||
const messages = _(res.data)
|
||||
.map((messages, type) => messages.map(transformers[type]))
|
||||
.map((messages, type) => transformers[type](messages))
|
||||
.flatten()
|
||||
.value();
|
||||
|
||||
|
||||
@@ -5,55 +5,58 @@ var githubEvent = require('parse-github-event');
|
||||
var twitterText = require('twitter-text');
|
||||
|
||||
module.exports = {
|
||||
github(item) {
|
||||
github(items) {
|
||||
return items.filter(({type}) => type !== 'PushEvent').map((item) => {
|
||||
|
||||
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
||||
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
||||
|
||||
var template = _.template(githubEvent.parse(item).text);
|
||||
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 repository = `https://github.com/${item.repo.name}`;
|
||||
var branch;
|
||||
if(item.payload.ref) {
|
||||
branch = item.payload.ref.replace('refs/heads/', '');
|
||||
}
|
||||
|
||||
var message = template({
|
||||
repository: `<a target="_blank" href="${repository}">${item.repo.name}</a>`,
|
||||
branch: branch,
|
||||
number: item.payload.number,
|
||||
ref_type: item.payload.ref_type,
|
||||
ref: item.payload.ref
|
||||
var message = template({
|
||||
repository: `<a target="_blank" href="${repository}">${item.repo.name}</a>`,
|
||||
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'
|
||||
};
|
||||
});
|
||||
|
||||
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(item) {
|
||||
twitter(items) {
|
||||
return items.map((item) => {
|
||||
if(item.retweeted) {
|
||||
item = item.retweeted_status;
|
||||
}
|
||||
|
||||
if(item.retweeted) {
|
||||
item = item.retweeted_status;
|
||||
}
|
||||
var url = `https://twitter.com/${item.user.screen_name}`;
|
||||
|
||||
var url = `https://twitter.com/${item.user.screen_name}`;
|
||||
|
||||
return {
|
||||
user: `@${item.user.screen_name}`,
|
||||
userLink: url,
|
||||
image: item.user.profile_image_url_https,
|
||||
imageLink: url,
|
||||
body: twitterText.autoLink(item.text),
|
||||
timestamp: new Date(item.created_at),
|
||||
type: 'twitter'
|
||||
};
|
||||
return {
|
||||
user: `@${item.user.screen_name}`,
|
||||
userLink: url,
|
||||
image: item.user.profile_image_url_https,
|
||||
imageLink: url,
|
||||
body: twitterText.autoLink(item.text),
|
||||
timestamp: new Date(item.created_at),
|
||||
type: 'twitter'
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user