Skip to content

Commit

Permalink
fix: SES-597 quoting your own message now works correctly in communities
Browse files Browse the repository at this point in the history
  • Loading branch information
yougotwill committed Jun 2, 2023
1 parent 3dc8097 commit 16b394d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ts/state/selectors/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 16b394d

Please sign in to comment.