diff --git a/__tests__/components/AppMenu.test.jsx b/__tests__/components/AppMenu.test.jsx index 9b11c37..c20bd5c 100644 --- a/__tests__/components/AppMenu.test.jsx +++ b/__tests__/components/AppMenu.test.jsx @@ -13,7 +13,6 @@ const defaultProps = { orgSnippets: {}, username: 'username', userSnippets: {}, - onDownloadClick: jest.fn(), }; describe('', () => { @@ -47,11 +46,7 @@ describe('', () => { onSignOut={onSignOut} />, ); - expect( - wrapper.find('MenuItem') - .find('[primaryText="Sign out"]') - .prop('onClick'), - ).toEqual(onSignOut); + expect(wrapper.find('MenuItem').prop('onClick')).toEqual(onSignOut); }); }); }); diff --git a/__tests__/components/__snapshots__/AppMenu.test.jsx.snap b/__tests__/components/__snapshots__/AppMenu.test.jsx.snap index 700389e..3fa0b99 100644 --- a/__tests__/components/__snapshots__/AppMenu.test.jsx.snap +++ b/__tests__/components/__snapshots__/AppMenu.test.jsx.snap @@ -50,20 +50,6 @@ exports[` snapshot tests matches snapshot of when user is logged in 1 - snapshot tests matches snapshot of when user is not logged - snapshot tests user is logged in 1`] = ` onRequestClose={[Function]} open={false} orderedSnippets={Array []} /> - `; @@ -256,11 +250,5 @@ exports[` snapshot tests user is not logged in 1`] = ` onRequestClose={[Function]} open={false} orderedSnippets={Array []} /> - `; diff --git a/src/actions/app.js b/src/actions/app.js index 6d7d3e7..8a1ad59 100644 --- a/src/actions/app.js +++ b/src/actions/app.js @@ -5,11 +5,7 @@ import { addNotification, closeNotification } from './notifications'; import { setAuthor, setPermissions } from './permissions'; import { fetchSnippetLists } from './user'; import { removeDeprecatedFiltersFromState } from '../util/codemirror-utils'; -import { - makeDumpEndpointUrl, - makeSaveEndpointUrl, - normalizeState, -} from '../util/requests'; +import { makeSaveEndpointUrl, normalizeState } from '../util/requests'; import { setDefaults } from '../util/state-management'; export const RESET_STATE = 'RESET_STATE'; @@ -227,21 +223,6 @@ export const deleteSnippet = snippetKey => (dispatch, getState) => { }); }; -export const downloadZip = selectedOrg => (dispatch) => { - dispatch(addNotification('Downloading snippets zip file.')); - return axios.post(makeDumpEndpointUrl(selectedOrg)) - .then(({ data: url }) => { - dispatch(closeNotification()); - dispatch(addNotification('Successfully downloaded zip file!')); - window.location = url; - }) - .catch((err) => { - dispatch(closeNotification()); - dispatch(addNotification('Failed to download snippets zip.')); - throw err; - }); -}; - export const loadSnippet = (snippetOwner, snippetKey) => (dispatch, getState) => { const { token } = getState().user; const reqHeaders = { diff --git a/src/components/DownloadDialog.jsx b/src/components/DownloadDialog.jsx deleted file mode 100644 index bc0cc8a..0000000 --- a/src/components/DownloadDialog.jsx +++ /dev/null @@ -1,78 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import { - Dialog, - FlatButton, -} from 'material-ui'; -import CustomPropTypes from '../util/custom-prop-types'; -import OrgSelector from './OrgSelector'; - -class DownloadDialog extends Component { - constructor(props) { - super(props); - this.state = { selectedOrg: '' }; - - this.handleOrgChanged = this.handleOrgChanged.bind(this); - } - - componentWillReceiveProps(nextProps) { - const { username } = nextProps; - const { selectedOrg } = this.state; - if (username && selectedOrg === '') { - this.setState({ selectedOrg: username }); - } - } - - handleOrgChanged(org) { - this.setState({ selectedOrg: org }); - } - - render() { - const { - open, - onDownloadClick, - onCanceled, - orgs, - } = this.props; - const { - selectedOrg, - } = this.state; - - const downloadDialogActions = [ - , - onDownloadClick(selectedOrg)} - />, - ]; - - return ( - - - - ); - } -} - -DownloadDialog.propTypes = { - open: PropTypes.bool.isRequired, - onDownloadClick: PropTypes.func.isRequired, - onCanceled: PropTypes.func.isRequired, - orgs: CustomPropTypes.orgs.isRequired, - username: PropTypes.string.isRequired, -}; - -export default DownloadDialog; diff --git a/src/components/menus/AppMenu.jsx b/src/components/menus/AppMenu.jsx index 0d00773..16d487e 100644 --- a/src/components/menus/AppMenu.jsx +++ b/src/components/menus/AppMenu.jsx @@ -62,7 +62,6 @@ class AppMenu extends Component { const { avatarUrl, onSignOut, - onDownloadClick, style, gists, onImportGist, @@ -87,10 +86,6 @@ class AppMenu extends Component { onClick={onImportGist} gists={gists} /> - - ); } @@ -395,7 +360,6 @@ CodesplainAppBar.propTypes = { userSnippets: CustomPropTypes.snippets, orderedSnippets: CustomPropTypes.orderedSnippets, snippetKey: PropTypes.string, - orgs: CustomPropTypes.orgs, }; CodesplainAppBar.defaultProps = { @@ -407,7 +371,6 @@ CodesplainAppBar.defaultProps = { userSnippets: {}, orderedSnippets: [], snippetKey: '', - orgs: [], }; const mapStateToProps = (state) => { @@ -423,7 +386,6 @@ const mapStateToProps = (state) => { token, username, userSnippets, - orgs, }, gists, } = state; @@ -439,7 +401,6 @@ const mapStateToProps = (state) => { userSnippets, orderedSnippets, snippetKey, - orgs, }; }; diff --git a/src/util/requests.js b/src/util/requests.js index ba0db1e..5880009 100644 --- a/src/util/requests.js +++ b/src/util/requests.js @@ -33,13 +33,6 @@ export const makeSaveEndpointUrl = (username, snippetId = '') => { return `${API_URL}/users/${username}/snippets`; }; -/* -Construct the REST endpoint for generating a zip file of the selectedOrg. -*/ -export const makeDumpEndpointUrl = selectedOrg => ( - `${API_URL}/users/${selectedOrg}/dump` -); - /* Construct the REST endpoint for obtaining the parser for the specified language.