diff --git a/ts/components/ConversationListItem.tsx b/ts/components/ConversationListItem.tsx index 73b889201..d08a0085a 100644 --- a/ts/components/ConversationListItem.tsx +++ b/ts/components/ConversationListItem.tsx @@ -23,7 +23,11 @@ import { DefaultTheme, withTheme } from 'styled-components'; import { PubKey } from '../session/types'; import { ConversationType, openConversationExternal } from '../state/ducks/conversations'; import { SessionIcon, SessionIconSize, SessionIconType } from './session/icon'; -import { SessionButtonColor } from './session/SessionButton'; + +export enum ConversationListItemType { + Conversation = 'conversation', + Contact = 'contact', +} export interface ConversationListItemProps extends ConversationType { index?: number; // used to force a refresh when one conversation is removed on top of the list @@ -33,6 +37,7 @@ export interface ConversationListItemProps extends ConversationType { type PropsHousekeeping = { style?: Object; theme: DefaultTheme; + conversationListItemType: ConversationListItemType; }; type Props = ConversationListItemProps & PropsHousekeeping; @@ -65,7 +70,7 @@ class ConversationListItem extends React.PureComponent { } public renderHeader() { - const { unreadCount, mentionedUs, activeAt, isPinned } = this.props; + const { unreadCount, mentionedUs, activeAt, isPinned, conversationListItemType } = this.props; let atSymbol = null; let unreadCountDiv = null; @@ -74,6 +79,15 @@ class ConversationListItem extends React.PureComponent { unreadCountDiv =

{unreadCount}

; } + const pinIcon = (conversationListItemType === ConversationListItemType.Conversation && isPinned) ? + + : + null; + + return (
{ {this.renderUser()}
- {isPinned ? - - : null - } + + {pinIcon} {unreadCountDiv} {atSymbol} { diff --git a/ts/components/session/LeftPaneContactSection.tsx b/ts/components/session/LeftPaneContactSection.tsx index 826db465c..d7db56a3e 100644 --- a/ts/components/session/LeftPaneContactSection.tsx +++ b/ts/components/session/LeftPaneContactSection.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { ConversationListItemWithDetails } from '../ConversationListItem'; +import { ConversationListItemType, ConversationListItemWithDetails } from '../ConversationListItem'; import { RowRendererParamsType } from '../LeftPane'; import { AutoSizer, List } from 'react-virtualized'; import { ConversationType as ReduxConversationType } from '../../state/ducks/conversations'; @@ -39,6 +39,7 @@ export class LeftPaneContactSection extends React.Component { return ( { return ( : null; + return ( <> - + {pinMenuItem} {getBlockMenuItem(isMe, type === ConversationTypeEnum.PRIVATE, isBlocked, conversationId)} {getCopyMenuItem(isPublic, isGroup, conversationId)} {getMarkAllReadMenuItem(conversationId)} diff --git a/ts/components/session/menu/Menu.tsx b/ts/components/session/menu/Menu.tsx index 5b38e38e8..9748b16a0 100644 --- a/ts/components/session/menu/Menu.tsx +++ b/ts/components/session/menu/Menu.tsx @@ -25,8 +25,6 @@ import { showUpdateGroupNameByConvoId, unblockConvoById, } from '../../../interactions/conversationInteractions'; -import { purgeStoredState } from 'redux-persist'; -import { persistConfig, _purgedStoredState } from '../../../state/createStore'; function showTimerOptions( isPublic: boolean, @@ -142,10 +140,6 @@ export const MenuItemPinConversation = (props: PinConversationMenuItemProps): JS ...conversation, isPinned: !isPinned })) - - if (isPinned) { - // purgeStoredState(persistConfig); - } } return {(isPinned ? 'Unpin' : 'Pin') + ' Conversation'} diff --git a/ts/util/accountManager.ts b/ts/util/accountManager.ts index 9f4e4286e..2151b15de 100644 --- a/ts/util/accountManager.ts +++ b/ts/util/accountManager.ts @@ -9,6 +9,7 @@ import { actions as userActions } from '../state/ducks/user'; import { mn_decode, mn_encode } from '../session/crypto/mnemonic'; import { ConversationTypeEnum } from '../models/conversation'; import _ from 'underscore'; +import { persistStore } from 'redux-persist'; /** * Might throw @@ -134,6 +135,10 @@ async function bouncyDeleteAccount(reason?: string) { await window.Signal.Data.removeOtherData(); // 'unlink' => toast will be shown on app restart window.localStorage.setItem('restart-reason', reason || ''); + if (window.inboxStore) { + // warrick: this part might be redundant due to localStorage getting cleared. + persistStore(window.inboxStore).purge(); + } }; try { window?.log?.info('DeleteAccount => Sending a last SyncConfiguration');