1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Moderation
//!
//! This is an attempt to semi-generalize the Bluesky moderation system. It avoids
//! depending on their lexicons as much as reasonably possible. This works via a
//! trait, [`Labeled`], which represents things that have labels for moderation
//! applied to them. This way the moderation application functions can operate
//! primarily via the trait, and are thus generic over lexicon types, and are
//! easy to use with your own types.
//!
//! For more complex types which might have labels applied to components,
//! there is the [`Moderateable`] trait. A mostly complete implementation for
//! `FeedViewPost` is available for reference. The trait method outputs a `Vec`
//! of tuples, where the first element is a string tag and the second is the
//! moderation decision for the tagged element. This lets application developers
//! change behaviour based on what part of the content got a label. The functions
//! mostly match Bluesky behaviour (respecting "!hide", and such) by default.
//!
//! I've taken the time to go through the generated API bindings and implement
//! the [`Labeled`] trait for a number of types. It's a fairly easy trait to
//! implement, just not really automatable.
//!
//!
//! # Example
//!
//! ```ignore
//! # use jacquard::moderation::*;
//! # use jacquard_api::app_bsky::feed::PostView;
//! # fn example(post: &PostView<'_>, prefs: &ModerationPrefs<'_>, defs: &LabelerDefs<'_>) {
//! let decision = moderate(post, prefs, defs, &[]);
//! if decision.filter {
//! // hide the post
//! } else if decision.blur != Blur::None {
//! // show with blur
//! }
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;