Merge pull request #1370 from processing/share-modal-wrong-username

Fixes #1349
This commit is contained in:
Cassie Tarakajian 2020-04-07 17:04:43 -04:00 committed by GitHub
commit 4f52c5893d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View file

@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { Link, browserHistory } from 'react-router'; import { Link } from 'react-router';
import InlineSVG from 'react-inlinesvg'; import InlineSVG from 'react-inlinesvg';
import classNames from 'classnames'; import classNames from 'classnames';
import * as IDEActions from '../modules/IDE/actions/ide'; import * as IDEActions from '../modules/IDE/actions/ide';
@ -167,8 +167,6 @@ class Nav extends React.PureComponent {
handleLogout() { handleLogout() {
this.props.logoutUser(); this.props.logoutUser();
// if you're on the settings page, probably.
browserHistory.push('/');
this.setDropdown('none'); this.setDropdown('none');
} }
@ -184,7 +182,8 @@ class Nav extends React.PureComponent {
} }
handleShare() { handleShare() {
this.props.showShareModal(); const { username } = this.props.params;
this.props.showShareModal(this.props.project.id, this.props.project.name, username);
this.setDropdown('none'); this.setDropdown('none');
} }
@ -717,6 +716,7 @@ Nav.propTypes = {
}).isRequired, }).isRequired,
project: PropTypes.shape({ project: PropTypes.shape({
id: PropTypes.string, id: PropTypes.string,
name: PropTypes.string,
owner: PropTypes.shape({ owner: PropTypes.shape({
id: PropTypes.string id: PropTypes.string
}) })
@ -742,7 +742,10 @@ Nav.propTypes = {
layout: PropTypes.oneOf(['dashboard', 'project']), layout: PropTypes.oneOf(['dashboard', 'project']),
rootFile: PropTypes.shape({ rootFile: PropTypes.shape({
id: PropTypes.string.isRequired id: PropTypes.string.isRequired
}).isRequired }).isRequired,
params: PropTypes.shape({
username: PropTypes.string
})
}; };
Nav.defaultProps = { Nav.defaultProps = {
@ -752,7 +755,10 @@ Nav.defaultProps = {
}, },
cmController: {}, cmController: {},
layout: 'project', layout: 'project',
warnIfUnsavedChanges: undefined warnIfUnsavedChanges: undefined,
params: {
username: undefined
}
}; };
function mapStateToProps(state) { function mapStateToProps(state) {

View file

@ -312,7 +312,7 @@ SketchListRowBase.propTypes = {
cloneProject: PropTypes.func.isRequired, cloneProject: PropTypes.func.isRequired,
exportProjectAsZip: PropTypes.func.isRequired, exportProjectAsZip: PropTypes.func.isRequired,
changeProjectName: PropTypes.func.isRequired, changeProjectName: PropTypes.func.isRequired,
onAddToCollection: PropTypes.func.isRequired, onAddToCollection: PropTypes.func.isRequired
}; };
function mapDispatchToPropsSketchListRow(dispatch) { function mapDispatchToPropsSketchListRow(dispatch) {