From 7bd55e96dc7d67a4bf6f3d46254e2c3a69220e28 Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 22 Jan 2018 13:37:15 -0300 Subject: [PATCH] [ICU-536] Fix link previews preference (#1364) * Fix link previews preference * Fixed grammar in a comment --- app/components/post_body_additional_content/index.js | 6 +++++- app/constants/view.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/post_body_additional_content/index.js b/app/components/post_body_additional_content/index.js index 9750744e2..ab4db7c34 100644 --- a/app/components/post_body_additional_content/index.js +++ b/app/components/post_body_additional_content/index.js @@ -36,9 +36,13 @@ function makeMapStateToProps() { return function mapStateToProps(state, ownProps) { const config = getConfig(state); - const previewsEnabled = getBool(state, Preferences.CATEGORY_ADVANCED_SETTINGS, `${ViewTypes.FEATURE_TOGGLE_PREFIX}${ViewTypes.EMBED_PREVIEW}`); const link = getFirstLink(ownProps.message); + // Link previews used to be an advanced settings until server version 4.4 when it was changed to be a display setting. + // We are checking both here until we bump the server requirement for the mobile apps. + const previewsEnabled = getBool(state, Preferences.CATEGORY_ADVANCED_SETTINGS, `${ViewTypes.FEATURE_TOGGLE_PREFIX}${ViewTypes.EMBED_PREVIEW}`) || + getBool(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.LINK_PREVIEW_DISPLAY, true); + return { ...getDimensions(state), config, diff --git a/app/constants/view.js b/app/constants/view.js index 6c3ad6c65..9114be382 100644 --- a/app/constants/view.js +++ b/app/constants/view.js @@ -68,6 +68,7 @@ export default { POST_VISIBILITY_CHUNK_SIZE: 15, FEATURE_TOGGLE_PREFIX: 'feature_enabled_', EMBED_PREVIEW: 'embed_preview', + LINK_PREVIEW_DISPLAY: 'link_previews', MIN_CHANNELNAME_LENGTH: 2, MAX_CHANNELNAME_LENGTH: 22, ANDROID_TOP_LANDSCAPE: 46,