mattermost-mobile/app/reducers/views/post.js
Miguel Alatzar 7afa9aed01
[MM-23698] [MM-19559] Remove redux-offline and updated redux-persist (#4120)
* Remove redux-offline and configure redux-persist

* Fix typo

* Fix configure store

* Upgrade to redux-persist 6.0.0

* Add migration from redux-persist v4 to v6

* Replace AsyncStorage with MMKVStorage to boost storage speed

* Mock RNFastStorage

* Fix reactions test

* Fix clearing the store on logout

* Remove the need for LOGOUT_SUCCESS

* No need to pass persistConfig to middlewares()

* Remove unused imports

* Export connection

Accidentally removed this export.

* Add batch action name

Co-Authored-By: Elias Nahum <nahumhbl@gmail.com>

* Add batch action name

Co-Authored-By: Elias Nahum <nahumhbl@gmail.com>

* Add batch action name

Co-Authored-By: Elias Nahum <nahumhbl@gmail.com>

* Add batch action name

Co-Authored-By: Elias Nahum <nahumhbl@gmail.com>

* Fix delete post

* Fix leave channel

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2020-04-08 13:44:54 -07:00

46 lines
1.1 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {combineReducers} from 'redux';
import {UserTypes} from '@mm-redux/action_types';
import {ViewTypes} from 'app/constants';
function selectedMenuAction(state = {}, action) {
switch (action.type) {
case ViewTypes.SELECTED_ACTION_MENU:
return action.data;
default:
return state;
}
}
function submittedMenuActions(state = {}, action) {
switch (action.type) {
case ViewTypes.SUBMIT_ATTACHMENT_MENU_ACTION: {
const nextState = {...state};
if (nextState[action.postId]) {
nextState[action.postId] = {
...nextState[action.postId],
...action.data,
};
} else {
nextState[action.postId] = action.data;
}
return nextState;
}
default:
return state;
}
}
export default combineReducers({
// Currently selected menu action
selectedMenuAction,
// Submitted menu actions per post
submittedMenuActions,
});