mirror of
https://github.com/mikedilger/gossip.git
synced 2024-10-01 09:21:53 +00:00
Hide posts with content warnings until approved
This commit is contained in:
parent
4b50e91a1c
commit
cb2f613f9f
@ -310,7 +310,7 @@ fn render_post_actual(
|
||||
}
|
||||
|
||||
if person.muted > 0 {
|
||||
ui.label("MUTED POST");
|
||||
ui.label(RichText::new("MUTED POST").monospace().italics());
|
||||
} else {
|
||||
render_post_inner(app, ctx, ui, event, person, is_main_event, as_reply_to);
|
||||
}
|
||||
@ -479,6 +479,19 @@ fn render_post_inner(
|
||||
ui.label(serde_json::to_string_pretty(&event).unwrap());
|
||||
} else if app.render_qr == Some(event.id) {
|
||||
app.render_qr(ui, ctx, "feedqr", event.content.trim());
|
||||
} else if event.content_warning().is_some() && !app.approved.contains(&event.id) {
|
||||
ui.label(
|
||||
RichText::new(format!(
|
||||
"Content-Warning: {}",
|
||||
event.content_warning().unwrap()
|
||||
))
|
||||
.monospace()
|
||||
.italics(),
|
||||
);
|
||||
if ui.button("Show Post").clicked() {
|
||||
app.approved.insert(event.id);
|
||||
app.height.remove(&event.id); // will need to be recalculated.
|
||||
}
|
||||
} else if event.kind == EventKind::Repost {
|
||||
if let Ok(inner_event) = serde_json::from_str::<Event>(&event.content) {
|
||||
let inner_person = match GLOBALS.people.get(&inner_event.pubkey.into()) {
|
||||
|
@ -91,6 +91,7 @@ struct GossipUi {
|
||||
render_raw: Option<Id>,
|
||||
render_qr: Option<Id>,
|
||||
viewed: HashSet<Id>,
|
||||
approved: HashSet<Id>, // content warning posts
|
||||
height: HashMap<Id, f32>,
|
||||
|
||||
// Person page rendering ('npub', 'nprofile', or 'lud06')
|
||||
@ -238,6 +239,7 @@ impl GossipUi {
|
||||
render_raw: None,
|
||||
render_qr: None,
|
||||
viewed: HashSet::new(),
|
||||
approved: HashSet::new(),
|
||||
height: HashMap::new(),
|
||||
person_qr: None,
|
||||
setting_active_person: false,
|
||||
|
Loading…
Reference in New Issue
Block a user