fix bug of empty pubkey

This commit is contained in:
pablof7z 2023-03-16 02:12:46 +01:00
parent e00a3fc19c
commit a3dc27febd
2 changed files with 16 additions and 14 deletions

View file

@ -39,10 +39,10 @@
const input = document.getElementById('message-input'); const input = document.getElementById('message-input');
const message = input.value; const message = input.value;
input.value = ''; input.value = '';
let extraParams = { tags: [] }; let extraParams = { tags: [], tagPubKeys: [] };
// if this is the rootLevel we want to tag the owner of the site's pubkey // if this is the rootLevel we want to tag the owner of the site's pubkey
if (!rootNoteId) { extraParams.tagPubKeys = [websiteOwnerPubkey] } if (!rootNoteId && websiteOwnerPubkey) { extraParams.tagPubKeys = [websiteOwnerPubkey] }
// if we are responding to an event, we want to tag the event and the pubkey // if we are responding to an event, we want to tag the event and the pubkey
if ($selectedMessage) { if ($selectedMessage) {

View file

@ -147,7 +147,9 @@ class NstrAdapter {
if (tagPubKeys) { if (tagPubKeys) {
for (let pubkey of tagPubKeys) { for (let pubkey of tagPubKeys) {
event.tags.push(['p', pubkey]); if (pubkey) {
event.tags.push(['p', pubkey]);
}
} }
} }