diff --git a/__tests__/components/editor/ResourceTemplate.test.js b/__tests__/components/editor/ResourceTemplate.test.js
index 8c17b7b1a..7c25d6f3f 100644
--- a/__tests__/components/editor/ResourceTemplate.test.js
+++ b/__tests__/components/editor/ResourceTemplate.test.js
@@ -10,13 +10,11 @@ describe('', () => {
resourceLabel: 'BF2 Work',
}
const loadLanguages = jest.fn()
- const clearResourceURIMessage = jest.fn()
const wrapper = shallow()
+ retrieveResourceTemplate={jest.fn()} />)
it('loads the languages', () => {
expect(loadLanguages).toHaveBeenCalled()
})
diff --git a/src/actionCreators/messages.js b/src/actionCreators/messages.js
deleted file mode 100644
index d82f6b525..000000000
--- a/src/actionCreators/messages.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 Stanford University see LICENSE for license
-
-import { clearingResourceURIMessage } from 'actions/index'
-
-const clearResourceURIMessage = () => (dispatch, getState) => {
- if (getState().selectorReducer.editor.resourceURIMessage.show === false) {
- return // The resource URI message is already clear
- }
-
- dispatch(clearingResourceURIMessage())
-}
-
-export default clearResourceURIMessage
diff --git a/src/actionCreators/resources.js b/src/actionCreators/resources.js
index d31e110e3..e2f0de0a2 100644
--- a/src/actionCreators/resources.js
+++ b/src/actionCreators/resources.js
@@ -5,6 +5,7 @@ import {
assignBaseURL, updateStarted, updateFinished,
retrieveResourceStarted, setResource, updateProperty,
toggleCollapse, appendResource, clearResourceTemplates,
+ clearResourceURIMessage,
} from 'actions/index'
import { fetchResourceTemplate } from 'actionCreators/resourceTemplates'
import { updateRDFResource, loadRDFResource } from 'sinopiaServer'
@@ -47,12 +48,14 @@ export const newResource = resourceTemplateId => (dispatch) => {
const resource = {}
resource[resourceTemplateId] = {}
dispatch(clearResourceTemplates())
+ dispatch(clearResourceURIMessage())
dispatch(setResource(resource))
dispatch(stubResource(true))
}
// A thunk that stubs out an existing new resource
export const existingResource = (resource, uri) => (dispatch) => {
+ dispatch(clearResourceURIMessage())
dispatch(setResource(resource))
dispatch(assignBaseURL(uri))
dispatch(stubResource(false))
diff --git a/src/actions/index.js b/src/actions/index.js
index ed2b49437..6f24887ea 100644
--- a/src/actions/index.js
+++ b/src/actions/index.js
@@ -72,8 +72,8 @@ export const showResourceURIMessage = resourceUri => ({
payload: resourceUri,
})
-export const clearingResourceURIMessage = () => ({
- type: 'CLEARING_RESOURCE_URI_MESSAGE',
+export const clearResourceURIMessage = () => ({
+ type: 'CLEAR_RESOURCE_URI_MESSAGE',
})
export const updateStarted = () => ({
diff --git a/src/components/editor/ResourceTemplate.jsx b/src/components/editor/ResourceTemplate.jsx
index 352a44d77..d4dcff9d4 100644
--- a/src/components/editor/ResourceTemplate.jsx
+++ b/src/components/editor/ResourceTemplate.jsx
@@ -10,7 +10,6 @@ import { bindActionCreators } from 'redux'
import loadLanguages from 'actionCreators/languages'
import ResourceURIMessage from './ResourceURIMessage'
import _ from 'lodash'
-import clearResourceURIMessage from 'actionCreators/messages'
/**
* This is the root component of the editor on the resource edit page
@@ -19,7 +18,6 @@ class ResourceTemplate extends Component {
componentDidMount() {
// We load the languages once here so that each literal doesn't try to hit the LOC endpoint
this.props.loadLanguages()
- this.props.clearResourceURIMessage()
}
render() {
@@ -49,7 +47,6 @@ ResourceTemplate.propTypes = {
error: PropTypes.string,
newResource: PropTypes.func,
loadLanguages: PropTypes.func,
- clearResourceURIMessage: PropTypes.func,
}
const mapStateToProps = (state) => {
@@ -63,6 +60,6 @@ const mapStateToProps = (state) => {
}
}
-const mapDispatchToProps = dispatch => bindActionCreators({ loadLanguages, newResource, clearResourceURIMessage }, dispatch)
+const mapDispatchToProps = dispatch => bindActionCreators({ loadLanguages, newResource }, dispatch)
export default connect(mapStateToProps, mapDispatchToProps)(ResourceTemplate)
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 188900e40..077a9e4fe 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -3,7 +3,7 @@
import { combineReducers } from 'redux'
import authenticate from './authenticate'
import {
- removeMyItem, setItemsOrSelections, setBaseURL, showResourceURIMessage, clearingResourceURIMessage,
+ removeMyItem, setItemsOrSelections, setBaseURL, showResourceURIMessage, clearResourceURIMessage,
setMyItemsLang, showGroupChooser, closeGroupChooser, showRdfPreview,
} from './inputs'
import {
@@ -111,7 +111,7 @@ const handlers = {
RETRIEVE_RESOURCE_TEMPLATE_STARTED: clearRetrieveError,
SET_BASE_URL: setBaseURL,
SHOW_RESOURCE_URI_MESSAGE: showResourceURIMessage,
- CLEARING_RESOURCE_URI_MESSAGE: clearingResourceURIMessage,
+ CLEAR_RESOURCE_URI_MESSAGE: clearResourceURIMessage,
SHOW_SEARCH_RESULTS: showSearchResults,
SHOW_GROUP_CHOOSER: showGroupChooser,
CLOSE_GROUP_CHOOSER: closeGroupChooser,
diff --git a/src/reducers/inputs.js b/src/reducers/inputs.js
index 48003574c..82443e96f 100644
--- a/src/reducers/inputs.js
+++ b/src/reducers/inputs.js
@@ -153,7 +153,7 @@ export const showResourceURIMessage = (state, action) => {
* @param {Object} action the payload of the action is the URI returned from saving the resource
* @return {Object} the next redux state
*/
-export const clearingResourceURIMessage = (state) => {
+export const clearResourceURIMessage = (state) => {
const newState = { ...state }
newState.editor.resourceURIMessage.show = false