summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-04-12 17:24:43 -0400
committerCorey Hulen <corey@hulen.com>2017-04-12 14:24:43 -0700
commitf961378600b661a35adaae181bb6b2c12d0ae3cf (patch)
tree45e389cdb80593ac334b8f3a02247791eeb1329d /webapp/components/post_view
parentd405cff905eb316b21a8988750254d0e1cf35e3c (diff)
downloadchat-f961378600b661a35adaae181bb6b2c12d0ae3cf.tar.gz
chat-f961378600b661a35adaae181bb6b2c12d0ae3cf.tar.bz2
chat-f961378600b661a35adaae181bb6b2c12d0ae3cf.zip
PLT-6099 Added keys to contents of PostBodyAdditionalContent (#6059)
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r--webapp/components/post_view/components/post_body_additional_content.jsx23
1 files changed, 14 insertions, 9 deletions
diff --git a/webapp/components/post_view/components/post_body_additional_content.jsx b/webapp/components/post_view/components/post_body_additional_content.jsx
index 58b6f8498..549bb9faa 100644
--- a/webapp/components/post_view/components/post_body_additional_content.jsx
+++ b/webapp/components/post_view/components/post_body_additional_content.jsx
@@ -153,30 +153,36 @@ export default class PostBodyAdditionalContent extends React.Component {
render() {
if (this.isLinkToggleable() && !this.state.linkLoadError) {
- const messageWithToggle = [];
-
// if message has only one line and starts with a link place toggle in this only line
// else - place it in new line between message and embed
const prependToggle = (/^\s*https?:\/\/.*$/).test(this.props.post.message);
- messageWithToggle.push(
+
+ const toggle = (
<a
+ key='toggle'
className={`post__embed-visibility ${prependToggle ? 'pull-left' : ''}`}
data-expanded={this.state.embedVisible}
aria-label='Toggle Embed Visibility'
onClick={this.toggleEmbedVisibility}
/>
);
+ const message = (
+ <div key='message'>
+ {this.props.message}
+ </div>
+ );
+ let contents;
if (prependToggle) {
- messageWithToggle.push(this.props.message);
+ contents = [toggle, message];
} else {
- messageWithToggle.unshift(this.props.message);
+ contents = [message, toggle];
}
- let toggleableEmbed;
if (this.state.embedVisible) {
- toggleableEmbed = (
+ contents.push(
<div
+ key='embed'
className='post__embed-container'
>
{this.generateToggleableEmbed()}
@@ -186,8 +192,7 @@ export default class PostBodyAdditionalContent extends React.Component {
return (
<div>
- {messageWithToggle}
- {toggleableEmbed}
+ {contents}
</div>
);
}