Skip to content

Commit

Permalink
Remove uncovered branches related to file uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
Sekhmet committed Oct 26, 2017
1 parent 02c35f6 commit be92527
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 76 deletions.
17 changes: 2 additions & 15 deletions src/post/Write/editorReducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as authActions from '../../auth/authActions';
import * as editorActions from './editorActions';
import * as postActions from '../postActions';
import * as userActions from '../../user/userActions';

const defaultState = {
loading: false,
Expand All @@ -18,10 +17,7 @@ const editor = (state = defaultState, action) => {
case editorActions.ADD_EDITED_POST:
return {
...state,
editedPosts: [
...state.editedPosts,
action.payload,
],
editedPosts: [...state.editedPosts, action.payload],
};
case postActions.GET_CONTENT_SUCCESS:
return {
Expand Down Expand Up @@ -86,10 +82,7 @@ const editor = (state = defaultState, action) => {
case editorActions.DELETE_DRAFT_START:
return {
...state,
pendingDrafts: [
...state.pendingDrafts,
action.meta.id,
],
pendingDrafts: [...state.pendingDrafts, action.meta.id],
};
case editorActions.DELETE_DRAFT_SUCCESS: {
return {
Expand All @@ -103,12 +96,6 @@ const editor = (state = defaultState, action) => {
...state,
pendingDrafts: state.pendingDrafts.filter(id => id !== action.meta.id),
};
case userActions.UPLOAD_FILE_START:
return { ...state, loadingImg: true };

case userActions.UPLOAD_FILE_ERROR:
case userActions.UPLOAD_FILE_SUCCESS:
return { ...state, loadingImg: false };
default:
return state;
}
Expand Down
61 changes: 0 additions & 61 deletions src/user/userReducer.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import keyBy from 'lodash/keyBy';
import omit from 'lodash/omit';

import * as actions from './userActions';

const initialState = {
// Map<FilePublicId, File>
files: {},
// Whether a file is uploading.
// Map<FileName, Bool>
fileUploadIsLoading: {},
fileUploadError: null,
filesFetchError: null,
filesFetchIsLoading: true,
following: {
list: [],
pendingFollows: [],
Expand All @@ -21,56 +10,6 @@ const initialState = {

export default function userReducer(state = initialState, action) {
switch (action.type) {
case actions.UPLOAD_FILE_START: {
return {
...state,
fileUploadIsLoading: {
...state.fileUploadIsLoading,
[action.meta.filename]: true,
},
fileUploadError: null,
};
}
case actions.UPLOAD_FILE_SUCCESS: {
return {
...state,
files: {
...state.files,
[action.payload.public_id]: action.payload,
},
fileUploadIsLoading: omit(state.fileUploadIsLoading, [action.meta.filename]),
fileUploadError: null,
};
}
case actions.UPLOAD_FILE_ERROR: {
return {
...state,
fileUploadIsLoading: omit(state.fileUploadIsLoading, [action.meta.filename]),
fileUploadError: action.payload,
};
}
case actions.FETCH_FILES_START: {
return {
...state,
filesFetchIsLoading: true,
filesFetchError: null,
};
}
case actions.FETCH_FILES_SUCCESS: {
return {
...state,
files: keyBy(action.payload, 'public_id'),
filesFetchIsLoading: false,
filesFetchError: null,
};
}
case actions.FETCH_FILES_ERROR: {
return {
...state,
filesFetchIsLoading: false,
filesFetchError: action.payload,
};
}
case actions.GET_FOLLOWING_START:
return {
...state,
Expand Down

0 comments on commit be92527

Please sign in to comment.