show twitter retweets in a form of the original status. anchors to feed avatars

This commit is contained in:
Riku Rouvila
2015-02-06 16:40:00 +02:00
parent a0c3bfd12f
commit 0917fa9772
2 changed files with 15 additions and 2 deletions

View File

@@ -36,9 +36,16 @@ module.exports = React.createClass({
},
render() {
var messages = this.state.messages.map((message) => {
var image = <img className="message__image" src={message.image} />;
if(message.imageLink) {
image = <a target="_blank" href={message.imageLink}>{image}</a>;
}
return (
<div className="message">
<img className="message__image" src={message.image} />
{image}
<div className="message__content">
<div className="message__body" dangerouslySetInnerHTML={{__html:message.body}}></div>
<div className="message__icon">

View File

@@ -12,7 +12,6 @@ module.exports = {
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/', '');
@@ -27,6 +26,7 @@ module.exports = {
return {
image: item.actor.avatar_url,
imageLink: `//githubEvent.com/${item.actor.login}`,
body: `${item.actor.login} ${message}`,
timestamp: new Date(item.created_at),
url: message.url,
@@ -34,8 +34,14 @@ module.exports = {
};
},
twitter(item) {
if(item.retweeted) {
item = item.retweeted_status;
}
return {
image: item.user.profile_image_url,
imageLink: `//twitter.com/${item.user.screen_name}`,
body: twitterText.autoLink(item.text),
timestamp: new Date(item.created_at),
type: 'twitter'