From ea617cbc5732d5bb995d80b40c4db4850df72979 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 29 Oct 2020 16:33:51 +1100 Subject: [PATCH] remove stuff related to archived state for convo --- ts/state/ducks/conversations.ts | 46 +---------------------------- ts/state/selectors/conversations.ts | 7 ----- ts/state/smart/LeftPane.tsx | 3 +- 3 files changed, 2 insertions(+), 54 deletions(-) diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index cc96a530a..3edbef788 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -64,7 +64,6 @@ export type ConversationLookupType = { export type ConversationsStateType = { conversationLookup: ConversationLookupType; selectedConversation?: string; - showArchived: boolean; }; // Actions @@ -107,14 +106,6 @@ export type SelectedConversationChangedActionType = { messageId?: string; }; }; -type ShowInboxActionType = { - type: 'SHOW_INBOX'; - payload: null; -}; -type ShowArchivedConversationsActionType = { - type: 'SHOW_ARCHIVED_CONVERSATIONS'; - payload: null; -}; export type ConversationActionType = | ConversationAddedActionType @@ -124,9 +115,7 @@ export type ConversationActionType = | MessageExpiredActionType | SelectedConversationChangedActionType | MessageExpiredActionType - | SelectedConversationChangedActionType - | ShowInboxActionType - | ShowArchivedConversationsActionType; + | SelectedConversationChangedActionType; // Action Creators @@ -138,8 +127,6 @@ export const actions = { messageExpired, openConversationInternal, openConversationExternal, - showInbox, - showArchivedConversations, }; function conversationAdded( @@ -221,25 +208,12 @@ function openConversationExternal( }; } -function showInbox() { - return { - type: 'SHOW_INBOX', - payload: null, - }; -} -function showArchivedConversations() { - return { - type: 'SHOW_ARCHIVED_CONVERSATIONS', - payload: null, - }; -} // Reducer function getEmptyState(): ConversationsStateType { return { conversationLookup: {}, - showArchived: false, }; } @@ -269,7 +243,6 @@ export function reducer( const { id, data } = payload; const { conversationLookup } = state; - let showArchived = state.showArchived; let selectedConversation = state.selectedConversation; const existing = conversationLookup[id]; @@ -279,10 +252,6 @@ export function reducer( } if (selectedConversation === id) { - // Archived -> Inbox: we go back to the normal inbox view - if (existing.isArchived && !data.isArchived) { - showArchived = false; - } // Inbox -> Archived: no conversation is selected // Note: With today's stacked converastions architecture, this can result in weird // behavior - no selected conversation in the left pane, but a conversation show @@ -295,7 +264,6 @@ export function reducer( return { ...state, selectedConversation, - showArchived, conversationLookup: { ...conversationLookup, [id]: data, @@ -327,18 +295,6 @@ export function reducer( selectedConversation: id, }; } - if (action.type === 'SHOW_INBOX') { - return { - ...state, - showArchived: false, - }; - } - if (action.type === 'SHOW_ARCHIVED_CONVERSATIONS') { - return { - ...state, - showArchived: true, - }; - } return state; } diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 6af8c779f..168cbe133 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -30,13 +30,6 @@ export const getSelectedConversation = createSelector( } ); -export const getShowArchived = createSelector( - getConversations, - (state: ConversationsStateType): boolean => { - return Boolean(state.showArchived); - } -); - function getConversationTitle( conversation: ConversationType, options: { i18n: LocalizerType; ourRegionCode: string } diff --git a/ts/state/smart/LeftPane.tsx b/ts/state/smart/LeftPane.tsx index c2deed5dd..a6480be24 100644 --- a/ts/state/smart/LeftPane.tsx +++ b/ts/state/smart/LeftPane.tsx @@ -10,7 +10,7 @@ import { getRegionCode, getUserNumber, } from '../selectors/user'; -import { getLeftPaneLists, getShowArchived } from '../selectors/conversations'; +import { getLeftPaneLists } from '../selectors/conversations'; // Workaround: A react component's required properties are filtering up through connect() // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31363 @@ -28,7 +28,6 @@ const mapStateToProps = (state: StateType) => { ourNumber: getUserNumber(state), isSecondaryDevice: getIsSecondaryDevice(state), searchResults, - showArchived: getShowArchived(state), i18n: getIntl(state), unreadMessageCount: leftPaneList.unreadCount, theme: state.theme,