diff --git a/_locales/en/messages.json b/_locales/en/messages.json index e358968e0..121de6fb5 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -411,5 +411,7 @@ "audioMessageAutoplayDescription": "Automatically play consecutively sent audio messages", "clickToTrustContact": "Click to download media", "trustThisContactDialogTitle": "Trust $name$?", - "trustThisContactDialogDescription": "Are you sure you want to download media sent by $name$?" + "trustThisContactDialogDescription": "Are you sure you want to download media sent by $name$?", + "pinConversation": "Pin Conversation", + "unpinConversation": "Unpin Conversation" } diff --git a/ts/components/session/menu/Menu.tsx b/ts/components/session/menu/Menu.tsx index 9748b16a0..12a91216f 100644 --- a/ts/components/session/menu/Menu.tsx +++ b/ts/components/session/menu/Menu.tsx @@ -141,8 +141,8 @@ export const MenuItemPinConversation = (props: PinConversationMenuItemProps): JS isPinned: !isPinned })) } - - return {(isPinned ? 'Unpin' : 'Pin') + ' Conversation'} + const menuText = isPinned ? window.i18n('unpinConversation'): window.i18n('pinConversation'); + return {menuText} } export function getDeleteContactMenuItem( diff --git a/ts/state/createStore.ts b/ts/state/createStore.ts index 3f25f8771..ed0ac4b38 100644 --- a/ts/state/createStore.ts +++ b/ts/state/createStore.ts @@ -6,7 +6,6 @@ import { persistReducer } from 'redux-persist'; // tslint:disable-next-line: no-submodule-imports match-default-export-name import storage from 'redux-persist/lib/storage'; -import purgeStoredState from 'redux-persist/es/purgeStoredState'; // @ts-ignore const env = window.getEnvironment(); @@ -30,7 +29,7 @@ const logger = createLogger({ export const persistConfig = { key: 'root', storage, - whitelist: ['userConfig', 'conversations'], + whitelist: ['userConfig'] }; const persistedReducer = persistReducer(persistConfig, allReducers); @@ -41,7 +40,6 @@ const middlewareList = disableLogging ? [promise] : [promise, logger]; export const createStore = (initialState: any) => configureStore({ - // reducer: allReducers, reducer: persistedReducer, preloadedState: initialState, middleware: (getDefaultMiddleware: any) => getDefaultMiddleware().concat(middlewareList), diff --git a/ts/state/reducer.ts b/ts/state/reducer.ts index e757789d8..65ee3cc3c 100644 --- a/ts/state/reducer.ts +++ b/ts/state/reducer.ts @@ -14,6 +14,10 @@ import { defaultOnionReducer as onionPaths, OnionState } from './ducks/onion'; import { modalReducer as modals, ModalState } from './ducks/modalDialog'; import { userConfigReducer as userConfig, UserConfigState } from './ducks/userConfig'; +// tslint:disable-next-line: no-submodule-imports match-default-export-name +import storage from 'redux-persist/lib/storage'; +import persistReducer from 'redux-persist/lib/persistReducer'; + export type StateType = { search: SearchStateType; user: UserStateType; @@ -27,9 +31,15 @@ export type StateType = { userConfig: UserConfigState; }; +const conversationsPersistConfig = { + key: 'conversations', + storage, + whitelist: ['conversationLookup'] +} + export const reducers = { search, - conversations, + conversations: persistReducer(conversationsPersistConfig, conversations), user, theme, section,