Skip to content

Commit

Permalink
target reply correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalmi committed Jan 30, 2023
1 parent 2eade6b commit 101b1cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/components/MessageForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ export default class MessageForm extends Component {
const id = Nostr.toNostrHexAddress(msg.replyingTo);
const replyingTo = await Nostr.getMessageById(id);
event.tags = replyingTo.tags.slice();
const rootTag = replyingTo.tags.find((t) => t[0] === 'e' && t[3] === 'root');
let rootTag = replyingTo.tags.find((t) => t[0] === 'e' && t[3] === 'root');
if (!rootTag) {
rootTag = replyingTo.tags.find((t) => t[0] === 'e');
}
if (rootTag) {
event.tags.push(['e', id, '', 'reply']);
} else {
event.tags.push(['e', id, '', 'root']);
event.tags.unshift(['e', id, '', 'root']);
}
if (!event.tags.find((t) => t[0] === 'p' && t[1] === replyingTo.pubkey)) {
event.tags.push(['p', replyingTo.pubkey]);
Expand Down

0 comments on commit 101b1cc

Please sign in to comment.