diff options
Diffstat (limited to 'src/nostr/policy')
| -rw-r--r-- | src/nostr/policy/announcement.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nostr/policy/announcement.rs b/src/nostr/policy/announcement.rs index 353738b..61840fb 100644 --- a/src/nostr/policy/announcement.rs +++ b/src/nostr/policy/announcement.rs | |||
| @@ -5,9 +5,7 @@ | |||
| 5 | use nostr_relay_builder::prelude::{Alphabet, Event, Filter, Kind, PublicKey, SingleLetterTag}; | 5 | use nostr_relay_builder::prelude::{Alphabet, Event, Filter, Kind, PublicKey, SingleLetterTag}; |
| 6 | 6 | ||
| 7 | use super::PolicyContext; | 7 | use super::PolicyContext; |
| 8 | use crate::nostr::events::{ | 8 | use crate::nostr::events::{validate_announcement, RepositoryAnnouncement}; |
| 9 | validate_announcement, RepositoryAnnouncement, KIND_REPOSITORY_ANNOUNCEMENT, | ||
| 10 | }; | ||
| 11 | 9 | ||
| 12 | /// Result of announcement policy evaluation | 10 | /// Result of announcement policy evaluation |
| 13 | #[derive(Debug)] | 11 | #[derive(Debug)] |
| @@ -121,12 +119,10 @@ impl AnnouncementPolicy { | |||
| 121 | author: &PublicKey, | 119 | author: &PublicKey, |
| 122 | ) -> Result<bool, String> { | 120 | ) -> Result<bool, String> { |
| 123 | // Query all announcements with this identifier that are already in the database | 121 | // Query all announcements with this identifier that are already in the database |
| 124 | let filter = Filter::new() | 122 | let filter = Filter::new().kind(Kind::GitRepoAnnouncement).custom_tag( |
| 125 | .kind(Kind::from(KIND_REPOSITORY_ANNOUNCEMENT)) | 123 | SingleLetterTag::lowercase(Alphabet::D), |
| 126 | .custom_tag( | 124 | identifier.to_string(), |
| 127 | SingleLetterTag::lowercase(Alphabet::D), | 125 | ); |
| 128 | identifier.to_string(), | ||
| 129 | ); | ||
| 130 | 126 | ||
| 131 | let announcements: Vec<Event> = match self.ctx.database.query(filter).await { | 127 | let announcements: Vec<Event> = match self.ctx.database.query(filter).await { |
| 132 | Ok(events) => events.into_iter().collect(), | 128 | Ok(events) => events.into_iter().collect(), |