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

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

Loading…
Cancel
Save