Skip to content

Commit

Permalink
MM-14617 Updating dependencies. (mattermost#2561)
Browse files Browse the repository at this point in the history
* Upgrading dependencies.

* Redux update
  • Loading branch information
crspeller authored Apr 5, 2019
1 parent 45d2aaa commit 2aed712
Show file tree
Hide file tree
Showing 41 changed files with 2,047 additions and 1,144 deletions.
2 changes: 2 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
safari: 12,
},
modules: false,
corejs: 2,
debug: false,
useBuiltIns: 'usage',
shippedProposals: true,
Expand All @@ -34,6 +35,7 @@
},
debug: false,
useBuiltIns: 'usage',
corejs: 2,
shippedProposals: true,
}],
['@babel/preset-react', {
Expand Down
3 changes: 0 additions & 3 deletions components/__snapshots__/textbox.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ exports[`components/TextBox should match snapshot with required props 1`] = `
className="textbox-help-link"
id="helpTextLink"
rel="noopener noreferrer"
replace={false}
target="_blank"
to="/help/messaging"
>
Expand Down Expand Up @@ -298,7 +297,6 @@ exports[`components/TextBox should throw error when new property is too long 1`]
className="textbox-help-link"
id="helpTextLink"
rel="noopener noreferrer"
replace={false}
target="_blank"
to="/help/messaging"
>
Expand Down Expand Up @@ -454,7 +452,6 @@ exports[`components/TextBox should throw error when value is too long 1`] = `
className="textbox-help-link"
id="helpTextLink"
rel="noopener noreferrer"
replace={false}
target="_blank"
to="/help/messaging"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ exports[`components/AdminConsole should generate the routes 1`] = `
render={[Function]}
/>
<Redirect
push={false}
to="/system_analytics"
/>
</Switch>
Expand All @@ -125,7 +124,6 @@ exports[`components/AdminConsole should generate the routes 1`] = `

exports[`components/AdminConsole should redirect to / when not system admin 1`] = `
<Redirect
push={false}
to="/"
/>
`;
6 changes: 3 additions & 3 deletions components/admin_console/admin_sidebar/admin_sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Tooltip, OverlayTrigger} from 'react-bootstrap';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import {generateIndex} from 'utils/admin_console_index.jsx';
import {browserHistory} from 'utils/browser_history';

import AdminSidebarCategory from 'components/admin_console/admin_sidebar_category.jsx';
import AdminSidebarHeader from 'components/admin_console/admin_sidebar_header';
Expand All @@ -21,7 +22,6 @@ import SearchIcon from 'components/svg/search_icon.jsx';
export default class AdminSidebar extends React.Component {
static get contextTypes() {
return {
router: PropTypes.object.isRequired,
intl: intlShape.isRequired,
};
}
Expand Down Expand Up @@ -105,12 +105,12 @@ export default class AdminSidebar extends React.Component {
return;
}

const validSection = sections.indexOf(this.context.router.history.location.pathname.replace('/admin_console/', '')) !== -1;
const validSection = sections.indexOf(browserHistory.location.pathname.replace('/admin_console/', '')) !== -1;
if (!validSection) {
const visibleSections = this.visibleSections();
for (const section of sections) {
if (visibleSections.has(section)) {
this.context.router.history.replace('/admin_console/' + section);
browserHistory.replace('/admin_console/' + section);
break;
}
}
Expand Down
6 changes: 0 additions & 6 deletions components/admin_console/admin_sidebar_category.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ export default class AdminSidebarCategory extends React.Component {
};
}

static get contextTypes() {
return {
router: PropTypes.object.isRequired,
};
}

render() {
let link = this.props.parentLink;
let title = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ exports[`components/admin_console/group_settings/GroupRow should match snapshot,
className="group-actions"
>
<Link
replace={false}
to="/admin_console/access-control/groups/group-id"
>
<FormattedMessage
Expand Down Expand Up @@ -172,7 +171,6 @@ exports[`components/admin_console/group_settings/GroupRow should match snapshot,
className="group-actions"
>
<Link
replace={false}
to="/admin_console/access-control/groups/group-id"
>
<FormattedMessage
Expand Down Expand Up @@ -223,7 +221,6 @@ exports[`components/admin_console/group_settings/GroupRow should match snapshot,
className="group-actions"
>
<Link
replace={false}
to="/admin_console/access-control/groups/group-id"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ exports[`components/admin_console/permission_schemes_settings/permissions_scheme
>
<Link
className="edit-button"
replace={false}
to="/admin_console/permissions/team-override-scheme/id"
>
<FormattedMessage
Expand Down Expand Up @@ -186,7 +185,6 @@ exports[`components/admin_console/permission_schemes_settings/permissions_scheme
>
<Link
className="edit-button"
replace={false}
to="/admin_console/permissions/team-override-scheme/id"
>
<FormattedMessage
Expand Down Expand Up @@ -380,7 +378,6 @@ exports[`components/admin_console/permission_schemes_settings/permissions_scheme
>
<Link
className="edit-button"
replace={false}
to="/admin_console/permissions/team-override-scheme/id"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ exports[`components/CopyUrlContextMenu should copy absolute url on click 1`] = `
attributes={Object {}}
collect={[Function]}
disable={false}
disableIfShiftIsPressed={false}
holdToDisplay={1000}
id="copy-url-context-menuresource"
posX={0}
Expand Down Expand Up @@ -83,6 +84,7 @@ exports[`components/CopyUrlContextMenu should copy relative url on click 1`] = `
attributes={Object {}}
collect={[Function]}
disable={false}
disableIfShiftIsPressed={false}
holdToDisplay={1000}
id="copy-url-context-menuresource"
posX={0}
Expand Down
12 changes: 6 additions & 6 deletions components/create_comment/create_comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export default class CreateComment extends React.PureComponent {
if (allowSending) {
e.persist();
if (this.refs.textbox) {
this.refs.textbox.getWrappedInstance().blur();
this.refs.textbox.blur();
}

if (withClosedCodeBlock && message) {
Expand Down Expand Up @@ -545,7 +545,7 @@ export default class CreateComment extends React.PureComponent {
if (!e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && Utils.isKeyPressed(e, Constants.KeyCodes.UP) && message === '') {
e.preventDefault();
if (this.refs.textbox) {
this.refs.textbox.getWrappedInstance().blur();
this.refs.textbox.blur();
}

const {data: canEditNow} = this.props.onEditLatestPost();
Expand Down Expand Up @@ -668,8 +668,8 @@ export default class CreateComment extends React.PureComponent {
if (index !== -1) {
uploadsInProgress.splice(index, 1);

if (this.refs.fileUpload && this.refs.fileUpload.getWrappedInstance()) {
this.refs.fileUpload.getWrappedInstance().cancelUpload(id);
if (this.refs.fileUpload && this.refs.fileUpload) {
this.refs.fileUpload.cancelUpload(id);
}
}
} else {
Expand Down Expand Up @@ -700,7 +700,7 @@ export default class CreateComment extends React.PureComponent {
}

getFileUploadTarget = () => {
return this.refs.textbox.getWrappedInstance();
return this.refs.textbox;
}

getCreateCommentControls = () => {
Expand All @@ -717,7 +717,7 @@ export default class CreateComment extends React.PureComponent {

focusTextbox = (keepFocus = false) => {
if (this.refs.textbox && (keepFocus || !UserAgent.isMobile())) {
this.refs.textbox.getWrappedInstance().focus();
this.refs.textbox.focus();
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/create_comment/create_comment.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ describe('components/CreateComment', () => {
instance.focusTextbox = jest.fn();
const blur = jest.fn();
const focus = jest.fn();
instance.refs = {textbox: {getWrappedInstance: () => ({blur, focus})}};
instance.refs = {textbox: {blur, focus}};

const commentMsgKey = {
preventDefault: jest.fn(),
Expand Down
12 changes: 6 additions & 6 deletions components/create_post/create_post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ export default class CreatePost extends React.Component {

focusTextbox = (keepFocus = false) => {
if (this.refs.textbox && (keepFocus || !UserAgent.isMobile())) {
this.refs.textbox.getWrappedInstance().focus();
this.refs.textbox.focus();
}
}

Expand All @@ -632,7 +632,7 @@ export default class CreatePost extends React.Component {
if (allowSending) {
e.persist();
if (this.refs.textbox) {
this.refs.textbox.getWrappedInstance().blur();
this.refs.textbox.blur();
}

if (withClosedCodeBlock && message) {
Expand Down Expand Up @@ -788,8 +788,8 @@ export default class CreatePost extends React.Component {
uploadsInProgress,
};

if (this.refs.fileUpload && this.refs.fileUpload.getWrappedInstance()) {
this.refs.fileUpload.getWrappedInstance().cancelUpload(id);
if (this.refs.fileUpload && this.refs.fileUpload) {
this.refs.fileUpload.cancelUpload(id);
}
}
} else {
Expand Down Expand Up @@ -846,7 +846,7 @@ export default class CreatePost extends React.Component {

getFileUploadTarget = () => {
if (this.refs.textbox) {
return this.refs.textbox.getWrappedInstance();
return this.refs.textbox;
}

return null;
Expand Down Expand Up @@ -902,7 +902,7 @@ export default class CreatePost extends React.Component {
type = Utils.localizeMessage('create_post.post', Posts.MESSAGE_TYPES.POST);
}
if (this.refs.textbox) {
this.refs.textbox.getWrappedInstance().blur();
this.refs.textbox.blur();
}
this.props.actions.setEditingPost(lastPost.id, this.props.commentCountForPost, 'post_textbox', type);
}
Expand Down
4 changes: 2 additions & 2 deletions components/create_post/create_post.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe('components/create_post', () => {

it('onKeyPress textbox should call emitLocalUserTypingEvent', () => {
const wrapper = shallowWithIntl(createPost());
wrapper.instance().refs = {textbox: {getWrappedInstance: () => ({blur: jest.fn()})}};
wrapper.instance().refs = {textbox: {blur: jest.fn()}};

const postTextbox = wrapper.find('#post_textbox');
postTextbox.simulate('KeyPress', {key: KeyCodes.ENTER[0], preventDefault: jest.fn(), persist: jest.fn()});
Expand Down Expand Up @@ -618,7 +618,7 @@ describe('components/create_post', () => {
}));

const instance = wrapper.instance();
instance.refs = {textbox: {getWrappedInstance: () => ({blur: jest.fn()})}};
instance.refs = {textbox: {blur: jest.fn()}};

instance.handleKeyDown({ctrlKey: true, key: Constants.KeyCodes.ENTER[0], keyCode: Constants.KeyCodes.ENTER[1], preventDefault: jest.fn(), persist: jest.fn()});
setTimeout(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ exports[`/components/create_team should match snapshot 1`] = `
render={[Function]}
/>
<Redirect
push={false}
to="https://localhost:8065/create_team/display_name"
/>
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ class EditChannelHeaderModal extends React.PureComponent {

focusTextbox = () => {
if (this.refs.editChannelHeaderTextbox) {
this.refs.editChannelHeaderTextbox.getWrappedInstance().focus();
this.refs.editChannelHeaderTextbox.focus();
}
}

blurTextbox = () => {
if (this.refs.editChannelHeaderTextbox) {
this.refs.editChannelHeaderTextbox.getWrappedInstance().blur();
this.refs.editChannelHeaderTextbox.blur();
}
}

Expand Down
4 changes: 1 addition & 3 deletions components/edit_post_modal/edit_post_modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ export default class EditPostModal extends React.PureComponent {
}

setEditboxRef = (ref) => {
if (ref && ref.getWrappedInstance) {
this.editbox = ref.getWrappedInstance();
}
this.editbox = ref;

if (this.editbox) {
this.editbox.focus();
Expand Down
14 changes: 0 additions & 14 deletions components/edit_post_modal/edit_post_modal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,6 @@ describe('components/EditPostModal', () => {
expect(instance.handleHide).not.toBeCalled();
});

it('should set instance.editbox on setEditboxRef', () => {
const wrapper = shallow(createEditPost());

wrapper.instance().setEditboxRef();
expect(wrapper.instance().editbox).toEqual(undefined);

const focus = jest.fn();
const ref = {getWrappedInstance: () => ({focus})};
wrapper.instance().setEditboxRef(ref);
wrapper.update();
expect(wrapper.instance().editbox).toEqual({focus});
expect(wrapper.instance().editbox.focus).toHaveBeenCalledTimes(1);
});

it('should disable the button on not canEditPost and text in it', () => {
const actions = {
editPost: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exports[`components/emoji/components/AddEmoji should match snapshot 1`] = `
>
<BackstageHeader>
<Link
replace={false}
to="/undefined/emoji"
>
<FormattedMessage
Expand Down Expand Up @@ -122,7 +121,6 @@ exports[`components/emoji/components/AddEmoji should match snapshot 1`] = `
/>
<Link
className="btn btn-link btn-sm"
replace={false}
to="/undefined/emoji"
>
<FormattedMessage
Expand Down Expand Up @@ -156,7 +154,6 @@ exports[`components/emoji/components/AddEmoji should select a file and match sna
>
<BackstageHeader>
<Link
replace={false}
to="/undefined/emoji"
>
<FormattedMessage
Expand Down Expand Up @@ -309,7 +306,6 @@ exports[`components/emoji/components/AddEmoji should select a file and match sna
/>
<Link
className="btn btn-link btn-sm"
replace={false}
to="/undefined/emoji"
>
<FormattedMessage
Expand Down Expand Up @@ -343,7 +339,6 @@ exports[`components/emoji/components/AddEmoji should update emoji name and match
>
<BackstageHeader>
<Link
replace={false}
to="/undefined/emoji"
>
<FormattedMessage
Expand Down Expand Up @@ -459,7 +454,6 @@ exports[`components/emoji/components/AddEmoji should update emoji name and match
/>
<Link
className="btn btn-link btn-sm"
replace={false}
to="/undefined/emoji"
>
<FormattedMessage
Expand Down
2 changes: 1 addition & 1 deletion components/file_upload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ function mapDispatchToProps(dispatch) {
};
}

export default connect(mapStateToProps, mapDispatchToProps, null, {withRef: true})(FileUpload);
export default connect(mapStateToProps, mapDispatchToProps, null, {forwardRef: true})(FileUpload);
Loading

0 comments on commit 2aed712

Please sign in to comment.