Merge pull request #1626 from mattermost/PLT-1355

PLT-1355 Move link preview into pre-release feature
Этот коммит содержится в:
Corey Hulen
2015-12-04 17:36:56 -08:00
родитель 265d982fbe 6d09d06c04
Коммит de411b648d
3 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@@ -6,6 +6,7 @@ import UserStore from '../stores/user_store.jsx';
import * as Utils from '../utils/utils.jsx'; import * as Utils from '../utils/utils.jsx';
import * as Emoji from '../utils/emoticons.jsx'; import * as Emoji from '../utils/emoticons.jsx';
import Constants from '../utils/constants.jsx'; import Constants from '../utils/constants.jsx';
const PreReleaseFeatures = Constants.PRE_RELEASE_FEATURES;
import * as TextFormatting from '../utils/text_formatting.jsx'; import * as TextFormatting from '../utils/text_formatting.jsx';
import twemoji from 'twemoji'; import twemoji from 'twemoji';
import PostBodyAdditionalContent from './post_body_additional_content.jsx'; import PostBodyAdditionalContent from './post_body_additional_content.jsx';
@@ -109,12 +110,14 @@ export default class PostBody extends React.Component {
const trimmedLink = link.trim(); const trimmedLink = link.trim();
const provider = this.getOembedProvider(trimmedLink); if (Utils.isFeatureEnabled(PreReleaseFeatures.EMBED_PREVIEW)) {
if (provider != null) { const provider = this.getOembedProvider(trimmedLink);
post.props.oEmbedLink = trimmedLink; if (provider != null) {
post.type = 'oEmbed'; post.props.oEmbedLink = trimmedLink;
this.setState({post, provider}); post.type = 'oEmbed';
return ''; this.setState({post, provider});
return '';
}
} }
const embed = this.createYoutubeEmbed(link); const embed = this.createYoutubeEmbed(link);

Просмотреть файл

@@ -195,7 +195,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
inputs.push( inputs.push(
<div key='advancedPreviewFeatures_helptext'> <div key='advancedPreviewFeatures_helptext'>
<br/> <br/>
{'Check any pre-released features you\'d like to preview.'} {'Check any pre-released features you\'d like to preview. You may also need to refresh the page before the setting will take effect.'}
</div> </div>
); );

Просмотреть файл

@@ -432,6 +432,10 @@ export default {
MARKDOWN_PREVIEW: { MARKDOWN_PREVIEW: {
label: 'markdown_preview', // github issue: https://github.com/mattermost/platform/pull/1389 label: 'markdown_preview', // github issue: https://github.com/mattermost/platform/pull/1389
description: 'Show markdown preview option in message input box' description: 'Show markdown preview option in message input box'
},
EMBED_PREVIEW: {
label: 'embed_preview',
description: 'Show preview snippet of links below message'
} }
} }
}; };