summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_body_additional_content.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components/post_body_additional_content.jsx')
-rw-r--r--web/react/components/post_body_additional_content.jsx28
1 files changed, 23 insertions, 5 deletions
diff --git a/web/react/components/post_body_additional_content.jsx b/web/react/components/post_body_additional_content.jsx
index 8189ba2d3..7e6f3f037 100644
--- a/web/react/components/post_body_additional_content.jsx
+++ b/web/react/components/post_body_additional_content.jsx
@@ -1,13 +1,15 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-const PostAttachmentList = require('./post_attachment_list.jsx');
+import PostAttachmentList from './post_attachment_list.jsx';
+import PostAttachmentOEmbed from './post_attachment_oembed.jsx';
export default class PostBodyAdditionalContent extends React.Component {
constructor(props) {
super(props);
this.getSlackAttachment = this.getSlackAttachment.bind(this);
+ this.getOembedAttachment = this.getOembedAttachment.bind(this);
this.getComponent = this.getComponent.bind(this);
}
@@ -25,17 +27,32 @@ export default class PostBodyAdditionalContent extends React.Component {
);
}
+ getOembedAttachment() {
+ const link = this.props.post.props && this.props.post.props.oEmbedLink || '';
+ return (
+ <PostAttachmentOEmbed
+ key={'post_body_additional_content' + this.props.post.id}
+ provider={this.props.provider}
+ link={link}
+ />
+ );
+ }
+
getComponent() {
- switch (this.state.type) {
+ switch (this.props.post.type) {
case 'slack_attachment':
return this.getSlackAttachment();
+ case 'oEmbed':
+ return this.getOembedAttachment();
+ default:
+ return '';
}
}
render() {
let content = [];
- if (this.state.shouldRender) {
+ if (Boolean(this.props.post.type)) {
const component = this.getComponent();
if (component) {
@@ -52,5 +69,6 @@ export default class PostBodyAdditionalContent extends React.Component {
}
PostBodyAdditionalContent.propTypes = {
- post: React.PropTypes.object.isRequired
-}; \ No newline at end of file
+ post: React.PropTypes.object.isRequired,
+ provider: React.PropTypes.object
+};