update repo list
This commit is contained in:
@@ -21,6 +21,8 @@ pub struct Announcement {
|
||||
pub euc: Option<String>,
|
||||
/// Other recognized maintainers.
|
||||
pub maintainers: Vec<PublicKey>,
|
||||
/// Hashtags labelling the repository (`t` tags).
|
||||
pub hashtags: Vec<String>,
|
||||
}
|
||||
|
||||
impl Announcement {
|
||||
@@ -38,13 +40,20 @@ impl Announcement {
|
||||
let mut relays: Vec<String> = Vec::new();
|
||||
let mut euc: Option<String> = None;
|
||||
let mut maintainers: Vec<PublicKey> = Vec::new();
|
||||
let mut hashtags: Vec<String> = Vec::new();
|
||||
|
||||
for tag in event.tags.iter() {
|
||||
// The `d` tag isn't part of the NIP-34 tag codec; parse it directly.
|
||||
// The `d` and `t` tags aren't part of the NIP-34 tag codec; parse them directly.
|
||||
if tag.kind() == "d" {
|
||||
id = tag.content().map(str::to_owned);
|
||||
continue;
|
||||
}
|
||||
if tag.kind() == "t" {
|
||||
if let Some(value) = tag.content() {
|
||||
hashtags.push(value.to_owned());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
match Nip34Tag::parse(tag.as_slice()) {
|
||||
Ok(Nip34Tag::Name(value)) => name = Some(value),
|
||||
@@ -73,6 +82,7 @@ impl Announcement {
|
||||
relays,
|
||||
euc,
|
||||
maintainers,
|
||||
hashtags,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -119,6 +129,8 @@ mod tests {
|
||||
&["relays", "wss://relay.example.com"],
|
||||
&["r", "aa231c4c6a5777dc89b42207b499891a344add5c", "euc"],
|
||||
&["maintainers", MAINTAINER_HEX],
|
||||
&["t", "rust"],
|
||||
&["t", "nostr"],
|
||||
]);
|
||||
|
||||
let announcement = Announcement::from_event(&event).expect("parses");
|
||||
@@ -141,6 +153,7 @@ mod tests {
|
||||
announcement.maintainers,
|
||||
vec![PublicKey::from_hex(MAINTAINER_HEX).expect("valid pubkey")]
|
||||
);
|
||||
assert_eq!(announcement.hashtags, vec!["rust", "nostr"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user