diff options
Diffstat (limited to 'src/bin/ngit/sub_commands/send.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs index c84e339..8b49e37 100644 --- a/src/bin/ngit/sub_commands/send.rs +++ b/src/bin/ngit/sub_commands/send.rs | |||
| @@ -4,12 +4,9 @@ use anyhow::{Context, Result, bail}; | |||
| 4 | use console::Style; | 4 | use console::Style; |
| 5 | use ngit::{ | 5 | use ngit::{ |
| 6 | client::{Params, send_events}, | 6 | client::{Params, send_events}, |
| 7 | git_events::generate_cover_letter_and_patch_events, | 7 | git_events::{EventRefType, generate_cover_letter_and_patch_events}, |
| 8 | }; | ||
| 9 | use nostr::{ | ||
| 10 | ToBech32, | ||
| 11 | nips::{nip10::Marker, nip19::Nip19Event}, | ||
| 12 | }; | 8 | }; |
| 9 | use nostr::{ToBech32, nips::nip19::Nip19Event}; | ||
| 13 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; | 10 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; |
| 14 | 11 | ||
| 15 | use crate::{ | 12 | use crate::{ |
| @@ -368,7 +365,7 @@ async fn get_root_proposal_id_and_mentions_from_in_reply_to( | |||
| 368 | in_reply_to: &[String], | 365 | in_reply_to: &[String], |
| 369 | ) -> Result<(Option<String>, Vec<nostr::Tag>)> { | 366 | ) -> Result<(Option<String>, Vec<nostr::Tag>)> { |
| 370 | let root_proposal_id = if let Some(first) = in_reply_to.first() { | 367 | let root_proposal_id = if let Some(first) = in_reply_to.first() { |
| 371 | match event_tag_from_nip19_or_hex(first, "in-reply-to", Marker::Root, true, false)? | 368 | match event_tag_from_nip19_or_hex(first, "in-reply-to", EventRefType::Root, true, false)? |
| 372 | .as_standardized() | 369 | .as_standardized() |
| 373 | { | 370 | { |
| 374 | Some(nostr_sdk::TagStandard::Event { | 371 | Some(nostr_sdk::TagStandard::Event { |
| @@ -404,10 +401,16 @@ async fn get_root_proposal_id_and_mentions_from_in_reply_to( | |||
| 404 | for (i, reply_to) in in_reply_to.iter().enumerate() { | 401 | for (i, reply_to) in in_reply_to.iter().enumerate() { |
| 405 | if i.ne(&0) || root_proposal_id.is_none() { | 402 | if i.ne(&0) || root_proposal_id.is_none() { |
| 406 | mention_tags.push( | 403 | mention_tags.push( |
| 407 | event_tag_from_nip19_or_hex(reply_to, "in-reply-to", Marker::Mention, true, false) | 404 | event_tag_from_nip19_or_hex( |
| 408 | .context(format!( | 405 | reply_to, |
| 409 | "{reply_to} in 'in-reply-to' not a valid nostr reference" | 406 | "in-reply-to", |
| 410 | ))?, | 407 | EventRefType::Quote, |
| 408 | true, | ||
| 409 | false, | ||
| 410 | ) | ||
| 411 | .context(format!( | ||
| 412 | "{reply_to} in 'in-reply-to' not a valid nostr reference" | ||
| 413 | ))?, | ||
| 411 | ); | 414 | ); |
| 412 | } | 415 | } |
| 413 | } | 416 | } |