Commit d6de9ffe authored by Ray Schamp's avatar Ray Schamp

Clean up activity item rendering logic

parent 5865b6d6
...@@ -36,25 +36,27 @@ var Activity = React.createClass({ ...@@ -36,25 +36,27 @@ var Activity = React.createClass({
{this.props.items && this.props.items.length > 0 ? [ {this.props.items && this.props.items.length > 0 ? [
<ul> <ul>
{this.props.items.map(function (item) { {this.props.items.map(function (item) {
var actorProfileUrl = '/users/' + item.actor.username + '/'; if (item.message.replace(/\s/g, '')) {
var actionDate = new Date(item.datetime_created + 'Z'); var actorProfileUrl = '/users/' + item.actor.username + '/';
var activityMessageHTML = '<a href=' + actorProfileUrl + '>' + var actionDate = new Date(item.datetime_created + 'Z');
item.actor.username + '</a>' + item.message; var activityMessageHTML = (
if (item.message.replace(/\s/g, '')) { '<a href=' + actorProfileUrl + '>' + item.actor.username + '</a>' +
return ( item.message
<li key={item.pk}> );
<a href={actorProfileUrl}> return (
<img src={item.actor.thumbnail_url} width="34" height="34" /> <li key={item.pk}>
<p dangerouslySetInnerHTML={{__html: activityMessageHTML}}></p> <a href={actorProfileUrl}>
<p> <img src={item.actor.thumbnail_url} width="34" height="34" />
<span className="stamp"> <p dangerouslySetInnerHTML={{__html: activityMessageHTML}}></p>
<FormattedRelative value={actionDate} /> <p>
</span> <span className="stamp">
</p> <FormattedRelative value={actionDate} />
</a> </span>
</li> </p>
); </a>
} </li>
);
}
})} })}
</ul> </ul>
] : [ ] : [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment