Commit a5676187 authored by Harrison Healey's avatar Harrison Healey Committed by Carlos Tadeu Panato Junior

MM-10602 Removed extra space from OpenGraph preview for links without a description (#1276)

* MM-10602 Removed extra space from OpenGraph preview for links without a description

* Removed unnecessary div
parent c73fb235
......@@ -156,7 +156,7 @@ export default class PostAttachmentOpenGraph extends React.PureComponent {
img.src = src;
}
imageToggleAnchoreTag(imageUrl) {
imageToggleAnchorTag(imageUrl) {
if (imageUrl && this.state.hasLargeImage) {
return (
<a
......@@ -282,6 +282,29 @@ export default class PostAttachmentOpenGraph extends React.PureComponent {
this.loadImage(imageUrl);
}
let body;
if (data.description || imageUrl) {
let separator;
if (data.description && imageUrl) {
separator = ' &nbsp';
}
body = (
<React.Fragment>
<div className={'attachment__body attachment__body--opengraph'}>
<div>
<div>
{this.truncateText(data.description)}
{separator}
{this.imageToggleAnchorTag(imageUrl)}
</div>
{this.imageTag(imageUrl, true)}
</div>
</div>
</React.Fragment>
);
}
return (
<div
className='attachment attachment--opengraph'
......@@ -309,19 +332,7 @@ export default class PostAttachmentOpenGraph extends React.PureComponent {
{this.truncateText(data.title || data.url || this.props.link)}
</a>
</h1>
<div >
<div
className={'attachment__body attachment__body--opengraph'}
>
<div>
<div>
{this.truncateText(data.description)} &nbsp;
{this.imageToggleAnchoreTag(imageUrl)}
</div>
{this.imageTag(imageUrl, true)}
</div>
</div>
</div>
{body}
</div>
{this.imageTag(imageUrl, false)}
</div>
......
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