From 16b394dbee8aa5843d6ee9a4e9fb3cda0f73306c Mon Sep 17 00:00:00 2001 From: William Grant Date: Fri, 2 Jun 2023 12:04:20 +1000 Subject: [PATCH] fix: SES-597 quoting your own message now works correctly in communities --- ts/state/selectors/conversations.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 351196769..ab07ed77d 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -40,9 +40,9 @@ import { ConversationTypeEnum } from '../../models/conversationAttributes'; import { MessageReactsSelectorProps } from '../../components/conversation/message/message-content/MessageReactions'; import { filter, isEmpty, pick, sortBy } from 'lodash'; import { processQuoteAttachment } from '../../models/message'; -import { PubKey } from '../../session/types'; import { isUsAnySogsFromCache } from '../../session/apis/open_group_api/sogsv3/knownBlindedkeys'; import { MessageModelType } from '../../models/messageType'; +import { PubKey } from '../../session/types'; export const getConversations = (state: StateType): ConversationsStateType => state.conversations; @@ -1001,12 +1001,17 @@ export const getMessageQuoteProps = createSelector( return undefined; } - const { id, author } = msgProps.quote; + let { id, author } = msgProps.quote; if (!id || !author) { return undefined; } - let isFromMe = UserUtils.isUsFromCache(author) || false; + const isFromMe = isUsAnySogsFromCache(author) || false; + + // NOTE the quote lookup map always stores our messages using the unblinded pubkey + if (isFromMe && PubKey.hasBlindedPrefix(author)) { + author = UserUtils.getOurPubKeyStrFromCache(); + } // NOTE: if the message is not found, we still want to render the quote const quoteNotFound = { @@ -1037,10 +1042,6 @@ export const getMessageQuoteProps = createSelector( return quoteNotFound; } - if (convo.isPublic && PubKey.hasBlindedPrefix(sourceMsgProps.sender)) { - isFromMe = isUsAnySogsFromCache(sourceMsgProps.sender); - } - const attachment = sourceMsgProps.attachments && sourceMsgProps.attachments[0]; const quote: PropsForQuote = {