remove stuff related to archived state for convo

pull/1387/head
Audric Ackermann 5 years ago
parent 387f8ff391
commit ea617cbc57
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -64,7 +64,6 @@ export type ConversationLookupType = {
export type ConversationsStateType = { export type ConversationsStateType = {
conversationLookup: ConversationLookupType; conversationLookup: ConversationLookupType;
selectedConversation?: string; selectedConversation?: string;
showArchived: boolean;
}; };
// Actions // Actions
@ -107,14 +106,6 @@ export type SelectedConversationChangedActionType = {
messageId?: string; messageId?: string;
}; };
}; };
type ShowInboxActionType = {
type: 'SHOW_INBOX';
payload: null;
};
type ShowArchivedConversationsActionType = {
type: 'SHOW_ARCHIVED_CONVERSATIONS';
payload: null;
};
export type ConversationActionType = export type ConversationActionType =
| ConversationAddedActionType | ConversationAddedActionType
@ -124,9 +115,7 @@ export type ConversationActionType =
| MessageExpiredActionType | MessageExpiredActionType
| SelectedConversationChangedActionType | SelectedConversationChangedActionType
| MessageExpiredActionType | MessageExpiredActionType
| SelectedConversationChangedActionType | SelectedConversationChangedActionType;
| ShowInboxActionType
| ShowArchivedConversationsActionType;
// Action Creators // Action Creators
@ -138,8 +127,6 @@ export const actions = {
messageExpired, messageExpired,
openConversationInternal, openConversationInternal,
openConversationExternal, openConversationExternal,
showInbox,
showArchivedConversations,
}; };
function conversationAdded( 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 // Reducer
function getEmptyState(): ConversationsStateType { function getEmptyState(): ConversationsStateType {
return { return {
conversationLookup: {}, conversationLookup: {},
showArchived: false,
}; };
} }
@ -269,7 +243,6 @@ export function reducer(
const { id, data } = payload; const { id, data } = payload;
const { conversationLookup } = state; const { conversationLookup } = state;
let showArchived = state.showArchived;
let selectedConversation = state.selectedConversation; let selectedConversation = state.selectedConversation;
const existing = conversationLookup[id]; const existing = conversationLookup[id];
@ -279,10 +252,6 @@ export function reducer(
} }
if (selectedConversation === id) { 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 // Inbox -> Archived: no conversation is selected
// Note: With today's stacked converastions architecture, this can result in weird // Note: With today's stacked converastions architecture, this can result in weird
// behavior - no selected conversation in the left pane, but a conversation show // behavior - no selected conversation in the left pane, but a conversation show
@ -295,7 +264,6 @@ export function reducer(
return { return {
...state, ...state,
selectedConversation, selectedConversation,
showArchived,
conversationLookup: { conversationLookup: {
...conversationLookup, ...conversationLookup,
[id]: data, [id]: data,
@ -327,18 +295,6 @@ export function reducer(
selectedConversation: id, selectedConversation: id,
}; };
} }
if (action.type === 'SHOW_INBOX') {
return {
...state,
showArchived: false,
};
}
if (action.type === 'SHOW_ARCHIVED_CONVERSATIONS') {
return {
...state,
showArchived: true,
};
}
return state; return state;
} }

@ -30,13 +30,6 @@ export const getSelectedConversation = createSelector(
} }
); );
export const getShowArchived = createSelector(
getConversations,
(state: ConversationsStateType): boolean => {
return Boolean(state.showArchived);
}
);
function getConversationTitle( function getConversationTitle(
conversation: ConversationType, conversation: ConversationType,
options: { i18n: LocalizerType; ourRegionCode: string } options: { i18n: LocalizerType; ourRegionCode: string }

@ -10,7 +10,7 @@ import {
getRegionCode, getRegionCode,
getUserNumber, getUserNumber,
} from '../selectors/user'; } 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() // Workaround: A react component's required properties are filtering up through connect()
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31363 // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31363
@ -28,7 +28,6 @@ const mapStateToProps = (state: StateType) => {
ourNumber: getUserNumber(state), ourNumber: getUserNumber(state),
isSecondaryDevice: getIsSecondaryDevice(state), isSecondaryDevice: getIsSecondaryDevice(state),
searchResults, searchResults,
showArchived: getShowArchived(state),
i18n: getIntl(state), i18n: getIntl(state),
unreadMessageCount: leftPaneList.unreadCount, unreadMessageCount: leftPaneList.unreadCount,
theme: state.theme, theme: state.theme,

Loading…
Cancel
Save