From 622692fe4d4f1623ae93d0daa3610e3883e6d07b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 13 Oct 2023 17:37:11 -0500 Subject: [PATCH] MentionNode: truncate Nostr usernames --- src/features/compose/editor/nodes/mention-node.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/features/compose/editor/nodes/mention-node.tsx b/src/features/compose/editor/nodes/mention-node.tsx index e170550ab4..2a47871668 100644 --- a/src/features/compose/editor/nodes/mention-node.tsx +++ b/src/features/compose/editor/nodes/mention-node.tsx @@ -9,6 +9,7 @@ import { $applyNodeReplacement, DecoratorNode } from 'lexical'; import React from 'react'; import { Tooltip } from 'soapbox/components/ui'; +import { isPubkey } from 'soapbox/utils/nostr'; import type { EditorConfig, @@ -87,7 +88,7 @@ class MentionNode extends DecoratorNode { type='button' dir='ltr' > - @{username} + @{isPubkey(username) ? username.slice(0, 8) : username} );