import React, { PropTypes, Component } from 'react';
import CardContent from '../ui/CardContent';

export default class CardContentList extends Component {
    static propTypes = {
        contents      : PropTypes.array.isRequired,
        userId        : PropTypes.number.isRequired,
        otherUserId   : PropTypes.number,
        onReport      : PropTypes.func,
    };

    constructor(props) {
        super(props);

        this.onReport = this.onReport.bind(this);
    }

    onReport(contentId, reason) {
        if (this.props.onReport) {
            this.props.onReport(contentId, reason);
        }
    }

    render() {
        const {contents, userId, otherUserId, onClickHandler} = this.props;
        return (
            <div className="content-list">
                {contents.map((content, index) => <CardContent key={index} hideLikeButton={false} {...content} loggedUserId={userId} otherUserId={otherUserId}
                                                               embed_id={content.embed ? content.embed.id : null} embed_type={content.embed ? content.embed.type : null}
                                                               fixedHeight={true}
                                                               onReport={this.onReport}/>)}
            </div>
        );
    }
}

@@ -512,47 +512,8 @@
 ) %7B%0A
-        if (this.props.onReport) %7B%0A    
     
@@ -560,18 +560,8 @@
 n);%0A
-        %7D%0A
     
@@ -626,24 +626,8 @@
 erId
-, onClickHandler
 %7D = 
@@ -1186,24 +1186,30 @@
 t=%7Bthis.
+props.
 onReport
 %7D/%3E)%7D%0A  
@@ -1200,16 +1200,39 @@
 onReport
+ ? this.onReport : null
 %7D/%3E)%7D%0A  

Make report optional in CardContent