mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-20 01:56:33 +00:00
name component fix
This commit is contained in:
parent
46fc215ee1
commit
241a278555
@ -2701,7 +2701,4 @@ input[type='text'] {
|
||||
.visible-xs-flex {
|
||||
display: none !important;
|
||||
}
|
||||
.msg.standalone:not(.quoting) {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
}
|
||||
|
@ -23,16 +23,11 @@ const Name = (props: Props) => {
|
||||
let initialName = '';
|
||||
let initialDisplayName;
|
||||
let isGenerated = false;
|
||||
const profileEvent = Events.db.find({ kind: 0, pubkey: nostrAddr });
|
||||
const profile = SocialNetwork.profiles.get(nostrAddr);
|
||||
// should we change SocialNetwork.getProfile() and use it here?
|
||||
if (profileEvent) {
|
||||
try {
|
||||
const profile = JSON.parse(profileEvent.content);
|
||||
initialName = profile.name?.trim().slice(0, 100) || '';
|
||||
initialDisplayName = profile.display_name?.trim().slice(0, 100);
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
if (profile) {
|
||||
initialName = profile.name?.trim().slice(0, 100) || '';
|
||||
initialDisplayName = profile.display_name?.trim().slice(0, 100);
|
||||
}
|
||||
if (!initialDisplayName) {
|
||||
initialDisplayName = AnimalName(Key.toNostrBech32Address(props.pub, 'npub') || props.pub);
|
||||
|
@ -44,6 +44,10 @@ const Note = ({
|
||||
const [translatedText, setTranslatedText] = useState('');
|
||||
showReplies = showReplies || 0;
|
||||
|
||||
if (showRepliedMsg === undefined) {
|
||||
showRepliedMsg = standalone;
|
||||
}
|
||||
|
||||
// TODO fetch replies in useEffect
|
||||
|
||||
let text = event.content || '';
|
||||
@ -253,9 +257,7 @@ const Note = ({
|
||||
function renderReplies() {
|
||||
return replies
|
||||
.slice(0, showReplies)
|
||||
.map((r) => (
|
||||
<EventComponent key={r} id={r} asReply={!standalone} showReplies={showReplies} />
|
||||
));
|
||||
.map((r) => <EventComponent key={r} id={r} asReply={!standalone} showReplies={0} />);
|
||||
}
|
||||
|
||||
function renderReplyForm() {
|
||||
|
Loading…
Reference in New Issue
Block a user