feat: dont show your pubkey in community quotes

pull/2806/head
William Grant 2 years ago committed by Audric Ackermann
parent 62c5ebb1fc
commit 41b488a71e

@ -29,7 +29,7 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
const { author, isIncoming } = props; const { author, isIncoming } = props;
const isPublic = useSelectedIsPublic(); const isPublic = useSelectedIsPublic();
const authorName = useQuoteAuthorName(author); const { authorName, isMe } = useQuoteAuthorName(author);
if (!author || !authorName) { if (!author || !authorName) {
return null; return null;
@ -41,7 +41,7 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
pubkey={PubKey.shorten(author)} pubkey={PubKey.shorten(author)}
name={authorName} name={authorName}
compact={true} compact={true}
shouldShowPubkey={Boolean(authorName && isPublic)} shouldShowPubkey={Boolean(authorName && !isMe && isPublic)}
/> />
</StyledQuoteAuthor> </StyledQuoteAuthor>
); );

@ -264,11 +264,17 @@ export function useIsTyping(conversationId?: string): boolean {
return useConversationPropsById(conversationId)?.isTyping || false; return useConversationPropsById(conversationId)?.isTyping || false;
} }
export function useQuoteAuthorName(authorId?: string) { export function useQuoteAuthorName(
authorId?: string
): { authorName: string | undefined; isMe: boolean } {
const convoProps = useConversationPropsById(authorId); const convoProps = useConversationPropsById(authorId);
return authorId && isUsAnySogsFromCache(authorId)
const isMe = Boolean(authorId && isUsAnySogsFromCache(authorId));
const authorName = isMe
? window.i18n('you') ? window.i18n('you')
: convoProps?.nickname || convoProps?.isPrivate : convoProps?.nickname || convoProps?.isPrivate
? convoProps?.displayNameInProfile ? convoProps?.displayNameInProfile
: undefined; : undefined;
return { authorName, isMe };
} }

Loading…
Cancel
Save