chore: address PR comments

pull/3281/head
Audric Ackermann 11 months ago
parent c72b9540b4
commit 8b6ca72053
No known key found for this signature in database

@ -344,6 +344,6 @@ input {
white-space: pre-wrap; white-space: pre-wrap;
svg { svg {
margin-right: var(--margins-xs); margin-inline-end: var(--margins-xs);
} }
} }

@ -41,7 +41,6 @@ const IconDiv = styled.div`
function DescriptionPubkeysReplaced({ description }: { description: string }) { function DescriptionPubkeysReplaced({ description }: { description: string }) {
// const replacedWithNames = useReplacePkInTextWithNames(description);
return ( return (
<DescriptionDiv> <DescriptionDiv>
<SessionHtmlRenderer html={description} /> <SessionHtmlRenderer html={description} />

@ -1,6 +1,5 @@
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { MessageModelType } from '../../models/messageType'; import { MessageModelType } from '../../models/messageType';
import { UserUtils } from '../../session/utils';
import { import {
MessageModelPropsWithConvoProps, MessageModelPropsWithConvoProps,
PropsForAttachment, PropsForAttachment,
@ -12,6 +11,7 @@ import { getIsMessageSelected, getMessagePropsByMessageId } from './conversation
import { useSelectedIsPrivate } from './selectedConversation'; import { useSelectedIsPrivate } from './selectedConversation';
import { LastMessageStatusType } from '../ducks/types'; import { LastMessageStatusType } from '../ducks/types';
import { PubKey } from '../../session/types'; import { PubKey } from '../../session/types';
import { useIsMe } from '../../hooks/useParamSelector';
function useMessagePropsByMessageId(messageId: string | undefined) { function useMessagePropsByMessageId(messageId: string | undefined) {
return useSelector((state: StateType) => getMessagePropsByMessageId(state, messageId)); return useSelector((state: StateType) => getMessagePropsByMessageId(state, messageId));
@ -32,16 +32,16 @@ const useSenderConvoProps = (
export const useAuthorProfileName = (messageId: string): string | null => { export const useAuthorProfileName = (messageId: string): string | null => {
const msg = useMessagePropsByMessageId(messageId); const msg = useMessagePropsByMessageId(messageId);
const senderProps = useSenderConvoProps(msg); const senderProps = useSenderConvoProps(msg);
const senderIsUs = useIsMe(msg?.propsForMessage?.sender);
if (!msg || !senderProps) { if (!msg || !senderProps) {
return null; return null;
} }
const { sender } = msg.propsForMessage;
const senderIsUs = sender === UserUtils.getOurPubKeyStrFromCache();
const authorProfileName = senderIsUs const authorProfileName = senderIsUs
? window.i18n('you') ? window.i18n('you')
: senderProps.nickname || senderProps.displayNameInProfile || PubKey.shorten(sender); : senderProps.nickname ||
senderProps.displayNameInProfile ||
PubKey.shorten(msg.propsForMessage.sender);
return authorProfileName || window.i18n('unknown'); return authorProfileName || window.i18n('unknown');
}; };

Loading…
Cancel
Save