feat: added PropsForExpirationSettings type

pull/2660/head
William Grant 2 years ago
parent 9a7a8903b8
commit 96ae50869f

@ -49,6 +49,14 @@ const StyledNonAdminDescription = styled.div`
line-height: 15px;
`;
export type PropsForExpirationSettings = {
expirationType: string | undefined;
expireTimer: number | undefined;
isMe: boolean | undefined;
isGroup: boolean | undefined;
weAreAdmin: boolean | undefined;
};
type OverlayDisappearingMessagesProps = { unlockNewModes: boolean };
export const OverlayDisappearingMessages = (props: OverlayDisappearingMessagesProps) => {
@ -81,8 +89,8 @@ export const OverlayDisappearingMessages = (props: OverlayDisappearingMessagesPr
convoProps.expireTimer && convoProps.expireTimer > -1
? convoProps.expireTimer
: isGroup
? DEFAULT_TIMER_OPTION.GROUP
: DEFAULT_TIMER_OPTION.PRIVATE_CONVERSATION
? DEFAULT_TIMER_OPTION.DELETE_AFTER_SEND
: DEFAULT_TIMER_OPTION.DELETE_AFTER_READ
);
// TODO verify that this if fine compared to updating in the useEffect

@ -38,6 +38,7 @@ import { MessageReactsSelectorProps } from '../../components/conversation/messag
import { filter, isEmpty, pick, sortBy } from 'lodash';
import { DisappearingMessageConversationSetting } from '../../util/expiringMessages';
import { ConversationHeaderTitleProps } from '../../components/conversation/header/ConversationHeaderTitle';
import { PropsForExpirationSettings } from '../../components/conversation/right-panel/overlay/disappearing-messages/OverlayDisappearingMessages';
export const getConversations = (state: StateType): ConversationsStateType => state.conversations;
@ -1235,9 +1236,10 @@ export const getSelectedConversationExpirationModesWithLegacy = createSelector(
export const getSelectedConversationExpirationSettings = createSelector(
getSelectedConversation,
(convo: ReduxConversationType | undefined) => ({
(convo: ReduxConversationType | undefined): PropsForExpirationSettings => ({
expirationType: convo?.expirationType,
expireTimer: convo?.expireTimer,
isMe: convo?.isMe,
isGroup: convo?.isGroup,
weAreAdmin: convo?.weAreAdmin,
})

Loading…
Cancel
Save