From 089e2864b3168c78d34a46876aa3ae123487f109 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 4 Feb 2021 11:39:07 -0800 Subject: [PATCH] Reduce unnecessary or overly verbose logging --- js/signal_protocol_store.js | 2 -- ts/ConversationController.ts | 4 +--- ts/models/conversations.ts | 15 +++++++++------ ts/sql/Server.ts | 4 ++-- ts/state/ducks/conversations.ts | 2 +- ts/state/selectors/conversations.ts | 4 ++-- ts/util/lint/exceptions.json | 2 +- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/js/signal_protocol_store.js b/js/signal_protocol_store.js index b5f7e45a31..180704e5c1 100644 --- a/js/signal_protocol_store.js +++ b/js/signal_protocol_store.js @@ -345,7 +345,6 @@ try { const id = await normalizeEncodedAddress(encodedAddress); - window.log.info('loadSession', { encodedAddress, id }); const session = this.sessions[id]; if (session) { @@ -366,7 +365,6 @@ try { const id = await normalizeEncodedAddress(encodedAddress); - window.log.info('storeSession', { encodedAddress, id }); const data = { id, diff --git a/ts/ConversationController.ts b/ts/ConversationController.ts index 57cb84728d..f891fd8698 100644 --- a/ts/ConversationController.ts +++ b/ts/ConversationController.ts @@ -395,10 +395,8 @@ export class ConversationController { // 3. Handle match on only UUID } if (!convoE164 && convoUuid) { - window.log.info( - `ensureContactIds: UUID-only match found (have e164: ${Boolean(e164)})` - ); if (e164 && highTrust) { + window.log.info('ensureContactIds: Adding e164 to UUID-only match'); convoUuid.updateE164(e164); updateConversation(convoUuid.attributes); } diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 004f13bb53..d62a5de755 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -2206,9 +2206,16 @@ export class ConversationModel extends window.Backbone.Model< return undefined; } + const emoji = this.get('aboutEmoji'); + const text = this.get('about'); + + if (!emoji) { + return text; + } + return window.i18n('message--getNotificationText--text-with-emoji', { - text: this.get('about'), - emoji: this.get('aboutEmoji'), + text, + emoji, }); } @@ -2743,10 +2750,6 @@ export class ConversationModel extends window.Backbone.Model< ); } - window.log.warn( - 'getMembers: Group conversation had neither membersV2 nor members' - ); - return []; } diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index 31ecc5cd4e..8bd2bfc69f 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -2828,7 +2828,7 @@ async function getLastConversationActivity({ type = 'group-v2-change' AND json_extract(json, '$.groupV2Change.from') != $ourConversationId AND json_extract(json, '$.groupV2Change.details.length') = 1 AND - json_extract(json, '$.groupV2Change.details[0].type') != 'member-remove' AND + json_extract(json, '$.groupV2Change.details[0].type') = 'member-remove' AND json_extract(json, '$.groupV2Change.details[0].conversationId') != $ourConversationId ) ORDER BY received_at DESC, sent_at DESC @@ -2870,7 +2870,7 @@ async function getLastConversationPreview({ type = 'group-v2-change' AND json_extract(json, '$.groupV2Change.from') != $ourConversationId AND json_extract(json, '$.groupV2Change.details.length') = 1 AND - json_extract(json, '$.groupV2Change.details[0].type') != 'member-remove' AND + json_extract(json, '$.groupV2Change.details[0].type') = 'member-remove' AND json_extract(json, '$.groupV2Change.details[0].conversationId') != $ourConversationId ) ORDER BY received_at DESC, sent_at DESC diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index bfaf68eceb..3593df3153 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -142,7 +142,7 @@ export type MessageType = { | 'verified-change' | 'message-history-unsynced' | 'call-history'; - quote?: { author: string }; + quote?: { author?: string; authorUuid?: string }; received_at: number; sent_at?: number; hasSignalAccount?: boolean; diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 3aa4606d42..9cda1fbbeb 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -423,8 +423,8 @@ export const getMessageSelector = createSelector( author = conversationSelector(ourNumber); } - if (quote) { - quoted = conversationSelector(quote.author); + if (quote && (quote.author || quote.authorUuid)) { + quoted = conversationSelector(quote.authorUuid || quote.author); } return messageSelector( diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index c025306fe8..0d6be4d69e 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -285,7 +285,7 @@ "rule": "jQuery-load(", "path": "js/signal_protocol_store.js", "line": " await ConversationController.load();", - "lineNumber": 1024, + "lineNumber": 1022, "reasonCategory": "falseMatch", "updated": "2020-06-12T14:20:09.936Z" },