@@ -84,7 +83,7 @@ const AvatarItem = (props: { source: string }) => {
return
;
};
-export const MessageSearchResult = (props: Props) => {
+export const MessageSearchResult = (props: MessageResultProps) => {
const {
isSelected,
id,
@@ -96,6 +95,8 @@ export const MessageSearchResult = (props: Props) => {
direction,
} = props;
+ // Some messages miss a source or destination. Doing checks to see if the fields can be derived from other sources.
+ // E.g. if the source is missing but the message is outgoing, the source will be our pubkey
const sourceOrDestinationDerivable =
(destination && direction === MessageDirection.outgoing) ||
!destination ||
diff --git a/ts/components/search/SearchResults.tsx b/ts/components/search/SearchResults.tsx
index 8a0b08e5c..c55d487e0 100644
--- a/ts/components/search/SearchResults.tsx
+++ b/ts/components/search/SearchResults.tsx
@@ -3,13 +3,12 @@ import {
ConversationListItemProps,
MemoConversationListItemWithDetails,
} from '../leftpane/conversation-list-item/ConversationListItem';
-import { MessageSearchResult } from './MessageSearchResults';
+import { MessageResultProps, MessageSearchResult } from './MessageSearchResults';
export type SearchResultsProps = {
contacts: Array
;
conversations: Array;
- // TODO: ww add proper typing
- messages: Array;
+ messages: Array;
hideMessagesHeader: boolean;
searchTerm: string;
};
diff --git a/ts/components/settings/section/CategoryAppearance.tsx b/ts/components/settings/section/CategoryAppearance.tsx
index 8bac7a476..66c421726 100644
--- a/ts/components/settings/section/CategoryAppearance.tsx
+++ b/ts/components/settings/section/CategoryAppearance.tsx
@@ -143,8 +143,6 @@ export const SettingsCategoryAppearance = (props: { hasPassword: boolean | null
title={window.i18n('trimDatabase')}
description={window.i18n('trimDatabaseDescription')}
onClick={async () => {
- console.warn('trim the database to last 10k messages');
-
const msgCount = await getMessageCount();
const deleteAmount = Math.max(msgCount - 10000, 0);
@@ -156,7 +154,7 @@ export const SettingsCategoryAppearance = (props: { hasPassword: boolean | null
onClickClose: () => {
updateConfirmModal(null);
},
- message: `Are you sure you want to delete your ${deleteAmount} oldest received messages?`,
+ message: window.i18n('trimDatabaseConfirmationBody', [`${deleteAmount}`]),
})
);
}}
diff --git a/ts/data/data.ts b/ts/data/data.ts
index 410865fa0..60e3ab467 100644
--- a/ts/data/data.ts
+++ b/ts/data/data.ts
@@ -822,8 +822,7 @@ export async function removeAllMessagesInConversation(conversationId: string): P
}
export async function trimMessages(): Promise {
- const count = await channels.trimMessages();
- console.warn({ count });
+ await channels.trimMessages(1000);
return;
}
diff --git a/ts/state/ducks/search.ts b/ts/state/ducks/search.ts
index 7a48f859b..de5cffd00 100644
--- a/ts/state/ducks/search.ts
+++ b/ts/state/ducks/search.ts
@@ -29,8 +29,7 @@ type SearchResultsPayloadType = {
conversations: Array;
contacts: Array;
- // TODO: ww typing
- messages?: Array;
+ messages?: Array;
};
type SearchResultsKickoffActionType = {
diff --git a/ts/types/LocalizerKeys.ts b/ts/types/LocalizerKeys.ts
index da5b86cbc..cf1da1f11 100644
--- a/ts/types/LocalizerKeys.ts
+++ b/ts/types/LocalizerKeys.ts
@@ -464,4 +464,5 @@ export type LocalizerKeys =
| 'editGroupName'
| 'trimDatabase'
| 'trimDatabaseDescription'
+ | 'trimDatabaseConfirmationBody'
| 'reportIssue';