From 0aedea6e60f22f78f3523b860027550159ba6dd8 Mon Sep 17 00:00:00 2001 From: Clemens Date: Mon, 25 Jul 2016 09:05:24 +0200 Subject: [PATCH] remove lastFileUpload field --- web/src/js/components/ContentView.jsx | 9 ++++----- web/src/js/components/ContentView/ContentViews.jsx | 4 ++-- web/src/js/components/FlowView/Messages.jsx | 5 +++-- web/src/js/ducks/flows.js | 2 +- web/src/js/ducks/ui/flow.js | 14 -------------- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx index 7c8ac510b..e88d1ce20 100644 --- a/web/src/js/components/ContentView.jsx +++ b/web/src/js/components/ContentView.jsx @@ -18,7 +18,7 @@ ContentView.propTypes = { ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2) function ContentView(props) { - const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, lastFileUpload, uploadContent, onContentChange, content, readonly } = props + const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, content, readonly } = props if (message.contentLength === 0) { return @@ -36,11 +36,11 @@ function ContentView(props) { return (
{View.textView ? ( - + ) : ( - + )}
@@ -72,11 +72,10 @@ export default connect( state => ({ contentView: state.ui.flow.contentView, displayLarge: state.ui.flow.displayLarge, - lastFileUpload: state.ui.flow.lastFileUpload }), { selectView: setContentView, displayLarge, - updateEdit, + updateEdit } )(ContentView) diff --git a/web/src/js/components/ContentView/ContentViews.jsx b/web/src/js/components/ContentView/ContentViews.jsx index 4ae6044b4..6c7f49009 100644 --- a/web/src/js/components/ContentView/ContentViews.jsx +++ b/web/src/js/components/ContentView/ContentViews.jsx @@ -60,10 +60,10 @@ ViewAuto.propTypes = { flow: React.PropTypes.object.isRequired, } -export function ViewAuto({ message, flow, readonly, lastFileUpload }) { +export function ViewAuto({ message, flow, readonly }) { const View = ViewAuto.findView(message) if (View.textView) { - return + return } else { return } diff --git a/web/src/js/components/FlowView/Messages.jsx b/web/src/js/components/FlowView/Messages.jsx index a3beaf849..9de25b5b4 100644 --- a/web/src/js/components/FlowView/Messages.jsx +++ b/web/src/js/components/FlowView/Messages.jsx @@ -9,7 +9,8 @@ import ValidateEditor from '../ValueEditor/ValidateEditor' import ValueEditor from '../ValueEditor/ValueEditor' import Headers from './Headers' -import { startEdit, updateEdit, uploadContent } from '../../ducks/ui/flow' +import { startEdit, updateEdit } from '../../ducks/ui/flow' +import * as FlowActions from '../../ducks/flows' import ToggleEdit from './ToggleEdit' function RequestLine({ flow, readonly, updateFlow }) { @@ -73,7 +74,7 @@ const Message = connect( }), { updateFlow: updateEdit, - uploadContent: uploadContent + uploadContent: FlowActions.uploadContent } ) diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index f18e48e6d..b197ff37e 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -112,7 +112,7 @@ export function update(flow, data) { return dispatch => fetchApi.put(`/flows/${flow.id}`, data) } -export function updateContent(flow, file, type) { +export function uploadContent(flow, file, type) { const body = new FormData() if (typeof file !== File) file = new Blob([file], {type: 'plain/text'}) diff --git a/web/src/js/ducks/ui/flow.js b/web/src/js/ducks/ui/flow.js index 268459559..62304994f 100644 --- a/web/src/js/ducks/ui/flow.js +++ b/web/src/js/ducks/ui/flow.js @@ -16,7 +16,6 @@ const defaultState = { displayLarge: false, modifiedFlow: false, contentView: 'ViewAuto', - lastFileUpload: false, tab: 'request', } @@ -42,12 +41,6 @@ export default function reducer(state = defaultState, action) { modifiedFlow: false } - case UPLOAD_CONTENT: - return { - ... state, - lastFileUpload: new Date() - } - case flowsActions.SELECT: return { ...state, @@ -98,13 +91,6 @@ export function updateEdit(update) { return { type: UPDATE_EDIT, update } } -export function uploadContent(flow, content, type){ - return (dispatch) => { - dispatch(flowsActions.updateContent(flow, content, type)) - dispatch({ type: UPLOAD_CONTENT }) - } -} - export function stopEdit(flow, modified_flow) { let diff = getDiff(flow, modified_flow) return (dispatch) => {