Skip to content

Commit

Permalink
MM-10360 Render OpenGraph previews for pages with an empty description (
Browse files Browse the repository at this point in the history
mattermost#1164)

* MM-10360 Render OpenGraph previews for pages with an empty description

* Updated mattermost-redux
  • Loading branch information
hmhealey authored May 3, 2018
1 parent 4a009ef commit 33d8a91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class PostAttachmentOpenGraph extends React.PureComponent {
height: 80,
width: 80,
};
this.textMaxLenght = 300;
this.textMaxLength = 300;
this.textEllipsis = '...';
this.largeImageMinRatio = 16 / 9;
this.smallImageContainerLeftPadding = 15;
Expand Down Expand Up @@ -227,8 +227,8 @@ export default class PostAttachmentOpenGraph extends React.PureComponent {
return element;
}

truncateText(text, maxLength = this.textMaxLenght, ellipsis = this.textEllipsis) {
if (text.length > maxLength) {
truncateText(text, maxLength = this.textMaxLength, ellipsis = this.textEllipsis) {
if (text && text.length > maxLength) {
return text.substring(0, maxLength - ellipsis.length) + ellipsis;
}
return text;
Expand Down Expand Up @@ -258,7 +258,7 @@ export default class PostAttachmentOpenGraph extends React.PureComponent {

render() {
const data = this.props.openGraphData;
if (!data || Utils.isEmptyObject(data.description) || this.state.removePreview) {
if (!data || data.description == null || this.state.removePreview) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"localforage": "1.5.6",
"localforage-observable": "1.4.0",
"marked": "mattermost/marked#4bc7e5f00c324d2eadec6b932224871497af6f7c",
"mattermost-redux": "mattermost/mattermost-redux#912553f719bce2a5c60d3ad528fd301f716441ce",
"mattermost-redux": "github:mattermost/mattermost-redux#6e347814cfefdd8ef3292fef2576ff8a0f082b58",
"moment-timezone": "0.5.14",
"pdfjs-dist": "2.0.290",
"perfect-scrollbar": "0.8.1",
Expand Down

0 comments on commit 33d8a91

Please sign in to comment.