Skip to content

Commit

Permalink
Reposts of protected events should not have the event in the content
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Jan 12, 2025
1 parent f60149f commit 197d67e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gossip-lib/src/overlord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,13 @@ impl Overlord {
}
};

let mut protected: bool = false;
for tag in &reposted_event.tags {
if tag.tagname() == "-" {
protected = true;
}
}

let relay_url = {
let seen_on = GLOBALS.db().get_event_seen_on_relay(reposted_event.id)?;
if seen_on.is_empty() {
Expand Down Expand Up @@ -2296,12 +2303,18 @@ impl Overlord {
tags.push(Tag::new(&["client", "gossip"]));
}

let content = if protected {
String::new()
} else {
serde_json::to_string(&reposted_event)?
};

let pre_event = PreEvent {
pubkey: public_key,
created_at: Unixtime::now(),
kind,
tags,
content: serde_json::to_string(&reposted_event)?,
content,
};

let powint = GLOBALS.db().read_setting_pow();
Expand Down

0 comments on commit 197d67e

Please sign in to comment.