summaryrefslogtreecommitdiffstats
path: root/webapp/components/admin_console
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-06 21:13:12 -0500
committerChristopher Speller <crspeller@gmail.com>2017-03-06 21:13:12 -0500
commite87f5c6cf912a4f650a056ee042f19268963177d (patch)
tree5bd573a645e8a3931ca2ee7131cac75d58871a5f /webapp/components/admin_console
parentf99658152ac2e188d8196758ef5c635eaa3b3ae7 (diff)
downloadchat-e87f5c6cf912a4f650a056ee042f19268963177d.tar.gz
chat-e87f5c6cf912a4f650a056ee042f19268963177d.tar.bz2
chat-e87f5c6cf912a4f650a056ee042f19268963177d.zip
Add system console switch for enabling link previews (#5663)
Diffstat (limited to 'webapp/components/admin_console')
-rw-r--r--webapp/components/admin_console/admin_sidebar.jsx10
-rw-r--r--webapp/components/admin_console/link_previews_settings.jsx66
2 files changed, 76 insertions, 0 deletions
diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx
index c53836ef6..2f299bdeb 100644
--- a/webapp/components/admin_console/admin_sidebar.jsx
+++ b/webapp/components/admin_console/admin_sidebar.jsx
@@ -690,6 +690,16 @@ export default class AdminSidebar extends React.Component {
}
/>
<AdminSidebarSection
+ name='link_previews'
+ title={
+ <FormattedMessage
+ id='admin.sidebar.linkPreviews'
+ defaultMessage='Link Previews'
+ />
+
+ }
+ />
+ <AdminSidebarSection
name='legal_and_support'
title={
<FormattedMessage
diff --git a/webapp/components/admin_console/link_previews_settings.jsx b/webapp/components/admin_console/link_previews_settings.jsx
new file mode 100644
index 000000000..aea8a56f1
--- /dev/null
+++ b/webapp/components/admin_console/link_previews_settings.jsx
@@ -0,0 +1,66 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import React from 'react';
+
+import AdminSettings from './admin_settings.jsx';
+import BooleanSetting from './boolean_setting.jsx';
+import {FormattedMessage} from 'react-intl';
+import SettingsGroup from './settings_group.jsx';
+
+export default class LinkPreviewsSettings extends AdminSettings {
+ constructor(props) {
+ super(props);
+
+ this.getConfigFromState = this.getConfigFromState.bind(this);
+
+ this.renderSettings = this.renderSettings.bind(this);
+ }
+
+ getConfigFromState(config) {
+ config.ServiceSettings.EnableLinkPreviews = this.state.enableLinkPreviews;
+
+ return config;
+ }
+
+ getStateFromConfig(config) {
+ return {
+ enableLinkPreviews: config.ServiceSettings.EnableLinkPreviews
+ };
+ }
+
+ renderTitle() {
+ return (
+ <h3>
+ <FormattedMessage
+ id='admin.customization.linkPreviews'
+ defaultMessage='Link Previews'
+ />
+ </h3>
+ );
+ }
+
+ renderSettings() {
+ return (
+ <SettingsGroup>
+ <BooleanSetting
+ id='enableLinkPreviews'
+ label={
+ <FormattedMessage
+ id='admin.customization.enableLinkPreviewsTitle'
+ defaultMessage='Enable Link Previews:'
+ />
+ }
+ helpText={
+ <FormattedMessage
+ id='admin.customization.enableLinkPreviewsDesc'
+ defaultMessage='Enable users to display a preview of website content below the message, if available. When true, website previews can be enabled from Account Settings > Advanced > Preview pre-release features.'
+ />
+ }
+ value={this.state.enableLinkPreviews}
+ onChange={this.handleChange}
+ />
+ </SettingsGroup>
+ );
+ }
+}