From 1e2ca3f8c83136edda7ec90e1ed90b39800f8e99 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Tue, 18 Feb 2025 11:06:16 +1300 Subject: [PATCH] fix NIP-86 listeventsneedingmoderation output --- src/web/management/mod.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/web/management/mod.rs b/src/web/management/mod.rs index a517e8c..542274a 100644 --- a/src/web/management/mod.rs +++ b/src/web/management/mod.rs @@ -6,9 +6,16 @@ use http_body_util::{BodyExt, Full}; use hyper::body::{Bytes, Incoming}; use hyper::{Request, Response, StatusCode}; use pocket_types::{Event, Filter, Id, Kind, Pubkey}; +use serde::Serialize; use serde_json::{json, Map, Value}; mod auth; +#[derive(Serialize)] +struct EventNeedingModeration { + id: String, + reason: String, +} + fn respond( json: serde_json::Value, status: StatusCode, @@ -339,7 +346,7 @@ pub fn handle_inner(pubkey: Pubkey, command: Value) -> Result, Err && !crate::is_authorized_user(e.pubkey()) }; - let mut need_moderation: Vec = Vec::new(); + let mut need_moderation: Vec = Vec::new(); let mut events = GLOBALS .store @@ -373,7 +380,10 @@ pub fn handle_inner(pubkey: Pubkey, command: Value) -> Result, Err continue; } - need_moderation.push(String::from_utf8_lossy(&event.as_json()?).to_string()); + need_moderation.push(EventNeedingModeration { + id: event.id().as_hex_string(), + reason: "unmoderated".to_string(), + }); } Ok(Some(json!({