From cb5551c1e9cdba8548ae5d0808d55c0dcd85cc48 Mon Sep 17 00:00:00 2001 From: Warrick Corfe-Tan Date: Sun, 14 Nov 2021 22:38:07 +1100 Subject: [PATCH] PR changes --- app/sql.js | 21 ------------------- .../session/LeftPaneMessageSection.tsx | 3 +-- ts/models/conversation.ts | 2 +- ts/receiver/dataMessage.ts | 1 - ts/session/utils/syncUtils.ts | 1 - ts/state/selectors/conversations.ts | 16 -------------- 6 files changed, 2 insertions(+), 42 deletions(-) diff --git a/app/sql.js b/app/sql.js index 76ae257a7..f81655201 100644 --- a/app/sql.js +++ b/app/sql.js @@ -835,7 +835,6 @@ const LOKI_SCHEMA_VERSIONS = [ updateToLokiSchemaVersion14, updateToLokiSchemaVersion15, updateToLokiSchemaVersion16, - updateToLokiSchemaVersion17, ]; function updateToLokiSchemaVersion1(currentVersion, db) { @@ -1229,23 +1228,6 @@ function updateToLokiSchemaVersion16(currentVersion, db) { console.log(`updateToLokiSchemaVersion${targetVersion}: success!`); } -function updateToLokiSchemaVersion17(currentVersion, db) { - const targetVersion = 17; - if (currentVersion >= targetVersion) { - return; - } - console.log(`updateToLokiSchemaVersion${targetVersion}: starting...`); - - db.transaction(() => { - db.exec(` - ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN isApproved BOOLEAN; - `); - - writeLokiSchemaVersion(targetVersion, db); - })(); - console.log(`updateToLokiSchemaVersion${targetVersion}: success!`); -} - function writeLokiSchemaVersion(newVersion, db) { db.prepare( `INSERT INTO loki_schema( @@ -1618,7 +1600,6 @@ function updateConversation(data) { type, members, name, - isApproved, profileName, } = data; @@ -1631,7 +1612,6 @@ function updateConversation(data) { type = $type, members = $members, name = $name, - isApproved = $isApproved, profileName = $profileName WHERE id = $id;` ) @@ -1643,7 +1623,6 @@ function updateConversation(data) { type, members: members ? members.join(' ') : null, name, - isApproved, profileName, }); } diff --git a/ts/components/session/LeftPaneMessageSection.tsx b/ts/components/session/LeftPaneMessageSection.tsx index 68a3b818d..6ee88f3d2 100644 --- a/ts/components/session/LeftPaneMessageSection.tsx +++ b/ts/components/session/LeftPaneMessageSection.tsx @@ -312,12 +312,11 @@ export class LeftPaneMessageSection extends React.Component { _.forEach(allConversations, convo => { if (convo.isApproved() !== true) { - convo.setIsApproved(true); + BlockedNumberController.block(convo.id); syncRequired = true; } }); if (syncRequired) { - // syncConfigurationIfNeeded(true); await forceSyncConfigurationNowIfNeeded(); } }} diff --git a/ts/models/conversation.ts b/ts/models/conversation.ts index b747c2bd2..b7f107557 100644 --- a/ts/models/conversation.ts +++ b/ts/models/conversation.ts @@ -146,7 +146,7 @@ export interface ConversationAttributesOptionals { triggerNotificationsFor?: ConversationNotificationSettingType; isTrustedForAttachmentDownload?: boolean; isPinned: boolean; - isApproved: boolean; + isApproved?: boolean; } /** diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 751ffe2db..47a8d3d68 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -424,7 +424,6 @@ export const isDuplicate = ( Math.abs(m.attributes.sent_at - testedMessage.timestamp) <= PUBLICCHAT_MIN_TIME_BETWEEN_DUPLICATE_MESSAGES; - debugger; return sameUsername && sameText && timestampsSimilar; }; diff --git a/ts/session/utils/syncUtils.ts b/ts/session/utils/syncUtils.ts index 52ca3e15a..9c6017bd5 100644 --- a/ts/session/utils/syncUtils.ts +++ b/ts/session/utils/syncUtils.ts @@ -89,7 +89,6 @@ export const forceSyncConfigurationNowIfNeeded = async (waitForMessageSent = fal resolve(true); } : undefined; - console.warn({configMessage}); void getMessageQueue().sendSyncMessage(configMessage, callback as any); // either we resolve from the callback if we need to wait for it, // or we don't want to wait, we resolve it here. diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index fd2ed734e..15ec06bba 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -352,22 +352,6 @@ export const getLeftPaneLists = createSelector( _getLeftPaneLists ); -export const getApprovedConversations = createSelector( - getConversationLookup, - (lookup: ConversationLookupType): Array => { - return Object.values(lookup).filter(convo => convo.isApproved === true); - } -); - -export const getUnapprovedConversations = createSelector( - getConversationLookup, - (lookup: ConversationLookupType): Array => { - return Object.values(lookup).filter( - convo => convo.isApproved === false || convo.isApproved === undefined - ); - } -); - export const getMe = createSelector( [getConversationLookup, getOurNumber], (lookup: ConversationLookupType, ourNumber: string): ReduxConversationType => {