From a90f22fef393dbf530e71f2b0d6f2de6ea427e97 Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Mon, 7 May 2018 23:26:46 +0500 Subject: [PATCH 01/10] Updating badge (#1177) --- sass/layout/_team-sidebar.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sass/layout/_team-sidebar.scss b/sass/layout/_team-sidebar.scss index f5477a91395c..51589decc204 100644 --- a/sass/layout/_team-sidebar.scss +++ b/sass/layout/_team-sidebar.scss @@ -75,8 +75,8 @@ .badge { font-size: 10px; position: absolute; - right: -6px; - top: -3px; + right: -8px; + top: -6px; &.stroked { border: 1px solid; From 91e3ce919b44ed8ebc59c311bc1f516cebcc9a36 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Tue, 8 May 2018 21:28:12 +0800 Subject: [PATCH 02/10] fix blank image after selecting user's profile image (#1188) --- components/setting_picture.jsx | 1 + .../setting_picture.test.jsx.snap | 434 ++++++++++++++++++ tests/components/setting_picture.test.jsx | 56 +++ 3 files changed, 491 insertions(+) create mode 100644 tests/components/__snapshots__/setting_picture.test.jsx.snap create mode 100644 tests/components/setting_picture.test.jsx diff --git a/components/setting_picture.jsx b/components/setting_picture.jsx index db51d78cdb02..996535888d5b 100644 --- a/components/setting_picture.jsx +++ b/components/setting_picture.jsx @@ -137,6 +137,7 @@ export default class SettingPicture extends Component {
diff --git a/tests/components/__snapshots__/setting_picture.test.jsx.snap b/tests/components/__snapshots__/setting_picture.test.jsx.snap new file mode 100644 index 000000000000..f3c67fe96111 --- /dev/null +++ b/tests/components/__snapshots__/setting_picture.test.jsx.snap @@ -0,0 +1,434 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/SettingItemMin should match snapshot, profile picture on file 1`] = ` + +`; + +exports[`components/SettingItemMin should match snapshot, profile picture on source 1`] = ` + +`; + +exports[`components/SettingItemMin should match snapshot, team icon on file 1`] = ` + +`; + +exports[`components/SettingItemMin should match snapshot, team icon on source 1`] = ` + +`; diff --git a/tests/components/setting_picture.test.jsx b/tests/components/setting_picture.test.jsx new file mode 100644 index 000000000000..35ea85b08014 --- /dev/null +++ b/tests/components/setting_picture.test.jsx @@ -0,0 +1,56 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import React from 'react'; +import {shallow} from 'enzyme'; + +import SettingPicture from 'components/setting_picture.jsx'; + +describe('components/SettingItemMin', () => { + const baseProps = { + clientError: '', + serverError: '', + src: 'http://localhost:8065/api/v4/users/src_id', + loadingPicture: false, + submitActive: false, + onSubmit: () => {}, // eslint-disable-line no-empty-function + title: 'Profile Picture', + onFileChange: () => {}, // eslint-disable-line no-empty-function + updateSection: () => {}, // eslint-disable-line no-empty-function + }; + + test('should match snapshot, profile picture on source', () => { + const wrapper = shallow( + + ); + + expect(wrapper).toMatchSnapshot(); + }); + + test('should match snapshot, profile picture on file', () => { + const props = {...baseProps, file: {file: {}}, src: ''}; + const wrapper = shallow( + + ); + + expect(wrapper).toMatchSnapshot(); + }); + + test('should match snapshot, team icon on source', () => { + const props = {...baseProps, onRemove: jest.fn(), imageContext: 'team'}; + const wrapper = shallow( + + ); + + expect(wrapper).toMatchSnapshot(); + }); + + test('should match snapshot, team icon on file', () => { + const props = {...baseProps, onRemove: jest.fn(), imageContext: 'team', file: {file: {}}, src: ''}; + const wrapper = shallow( + + ); + + expect(wrapper).toMatchSnapshot(); + }); +}); From adde61966ab47a45aa48a285ca92c22a347a97b1 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Tue, 8 May 2018 09:29:18 -0400 Subject: [PATCH 03/10] MM-10492 Fix saving plugin settings in the system console (#1186) * Fix saving plugin settings in the system console * Minor fix * Fix render plugins panels on refresh * Only update schema once when it first loads --- .../custom_plugin_settings.jsx | 20 ++++++++++++++----- .../admin_console/schema_admin_settings.jsx | 9 +++++++-- .../custom_plugin_settings.test.jsx.snap | 12 +++++------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/components/admin_console/custom_plugin_settings/custom_plugin_settings.jsx b/components/admin_console/custom_plugin_settings/custom_plugin_settings.jsx index 8e4e43a0b78e..1681a800b841 100644 --- a/components/admin_console/custom_plugin_settings/custom_plugin_settings.jsx +++ b/components/admin_console/custom_plugin_settings/custom_plugin_settings.jsx @@ -4,13 +4,18 @@ import SchemaAdminSettings from 'components/admin_console/schema_admin_settings.jsx'; export default class CustomPluginSettings extends SchemaAdminSettings { - componentWillReceiveProps = (nextProps) => { - if (nextProps.schema !== this.props.schema) { + constructor(props) { + super(props); + this.isPlugin = true; + } + + componentWillReceiveProps(nextProps) { + if (!this.props.schema && nextProps.schema) { this.setState(this.getStateFromConfig(nextProps.config, nextProps.schema)); } } - getConfigFromState = (config) => { + getConfigFromState(config) { const schema = this.props.schema; if (schema) { @@ -23,14 +28,19 @@ export default class CustomPluginSettings extends SchemaAdminSettings { const settings = schema.settings || []; settings.forEach((setting) => { const lowerKey = setting.key.toLowerCase(); - configSettings[lowerKey] = this.state[lowerKey]; + const value = this.state[lowerKey] || setting.default; + if (value == null) { + Reflect.deleteProperty(configSettings, lowerKey); + } else { + configSettings[lowerKey] = value; + } }); } return config; } - getStateFromConfig = (config, schema = this.props.schema) => { + getStateFromConfig(config, schema = this.props.schema) { const state = {}; if (schema) { diff --git a/components/admin_console/schema_admin_settings.jsx b/components/admin_console/schema_admin_settings.jsx index 019d272068ad..f9f5eb10f167 100644 --- a/components/admin_console/schema_admin_settings.jsx +++ b/components/admin_console/schema_admin_settings.jsx @@ -458,7 +458,12 @@ export default class SchemaAdminSettings extends AdminSettings { if (schema.settings) { schema.settings.forEach((setting) => { if (this.buildSettingFunctions[setting.type] && !this.isHidden(setting)) { - settingsList.push(this.buildSettingFunctions[setting.type](setting)); + // This is a hack required as plugin settings are case insensitive + let s = setting; + if (this.isPlugin) { + s = {...setting, key: setting.key.toLowerCase()}; + } + settingsList.push(this.buildSettingFunctions[setting.type](s)); } }); } @@ -495,7 +500,7 @@ export default class SchemaAdminSettings extends AdminSettings { render = () => { const schema = this.props.schema; - if (schema.component) { + if (schema && schema.component) { const CustomComponent = schema.component; return (); } diff --git a/tests/components/admin_console/__snapshots__/custom_plugin_settings.test.jsx.snap b/tests/components/admin_console/__snapshots__/custom_plugin_settings.test.jsx.snap index 1940dfef7cf0..4bdbf3688509 100644 --- a/tests/components/admin_console/__snapshots__/custom_plugin_settings.test.jsx.snap +++ b/tests/components/admin_console/__snapshots__/custom_plugin_settings.test.jsx.snap @@ -295,7 +295,7 @@ exports[`components/admin_console/CustomPluginSettings should match snapshot wit placeholder="e.g. some setting" setByEnv={false} type="input" - value="setting_default" + value="fsdsdg" /> } - value={true} + value={false} /> } setByEnv={false} - value="" + value="Q6DHXrFLOIS5sOI5JNF4PyDLqWm7vh23" />
Date: Tue, 8 May 2018 10:03:59 -0400 Subject: [PATCH 04/10] MM-9924: Fix incorrect post date for rootPostDay. (#1189) --- components/rhs_thread/rhs_thread.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/rhs_thread/rhs_thread.jsx b/components/rhs_thread/rhs_thread.jsx index d77c17dc33ab..92a11399c482 100644 --- a/components/rhs_thread/rhs_thread.jsx +++ b/components/rhs_thread/rhs_thread.jsx @@ -319,7 +319,7 @@ export default class RhsThread extends React.Component { let createAt = selected.create_at; if (!createAt) { - createAt = this.props.posts[0].create_at; + createAt = this.props.posts[this.props.posts.length - 1].create_at; } const rootPostDay = Utils.getDateForUnixTicks(createAt); let previousPostDay = rootPostDay; From a5b5a619e940a2570cd2d164b11fe517a41c82c4 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 9 May 2018 12:25:41 -0400 Subject: [PATCH 05/10] Fix the channel switcher after switching to a new DM (#1193) --- components/suggestion/switch_channel_provider.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/suggestion/switch_channel_provider.jsx b/components/suggestion/switch_channel_provider.jsx index 3f7dddd73821..ebccbcebf08e 100644 --- a/components/suggestion/switch_channel_provider.jsx +++ b/components/suggestion/switch_channel_provider.jsx @@ -155,14 +155,14 @@ function makeChannelSearchFilter(channelPrefix) { let searchString = channel.display_name; if (channel.type === Constants.GM_CHANNEL || channel.type === Constants.DM_CHANNEL) { - const usersInChannel = usersInChannels[channel.id] || []; + const usersInChannel = usersInChannels[channel.id] || new Set([]); // In case the channel is a DM and the profilesInChannel is not populated if (!usersInChannel.length && channel.type === Constants.DM_CHANNEL) { const userId = Utils.getUserIdFromChannelId(channel.name); const user = getUser(curState, userId); if (user) { - usersInChannel.push(userId); + usersInChannel.add(userId); } } From ed3f41f3ba9c370010c65bc0186113843ebec626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 9 May 2018 18:27:27 +0200 Subject: [PATCH 06/10] MM-10514: Remove delete channel link for town-square in classic app (#1192) * MM-10514: Remove delete channel link for town-square in classic app * Add test for default channel navbar rendering --- components/navbar/navbar.jsx | 4 +- .../navbar/__snapshots__/navbar.test.jsx.snap | 319 ++++++++++++++++++ tests/components/navbar/navbar.test.jsx | 10 + 3 files changed, 331 insertions(+), 2 deletions(-) diff --git a/components/navbar/navbar.jsx b/components/navbar/navbar.jsx index 24471dfa5225..937dc4543fec 100644 --- a/components/navbar/navbar.jsx +++ b/components/navbar/navbar.jsx @@ -647,7 +647,9 @@ export default class Navbar extends React.Component { ); + } + if (!ChannelStore.isDefault(channel)) { deleteChannelOption = ( ); - } - if (!ChannelStore.isDefault(channel)) { leaveChannelOption = (
  • + + + + +
  • +`; + exports[`components/navbar/Navbar should match snapshot, for private channel 1`] = `