+19
-16
crates/jacquard/src/moderation/tests.rs
+19
-16
crates/jacquard/src/moderation/tests.rs
···
4
};
5
use jacquard_api::app_bsky::feed::FeedViewPost;
6
use jacquard_api::app_bsky::labeler::get_services::GetServicesOutput;
7
-
use jacquard_api::com_atproto::label::{Label, LabelValueDefinition};
8
use jacquard_common::CowStr;
9
use jacquard_common::types::string::{Datetime, Did, Uri};
10
use serde::Deserialize;
···
50
// Create a label definition with defaultSetting: "hide"
51
let spam_def = LabelValueDefinition {
52
identifier: CowStr::from("spam"),
53
-
blurs: CowStr::from("content"),
54
-
severity: CowStr::from("inform"),
55
-
default_setting: Some(CowStr::from("hide")),
56
adult_only: Some(false),
57
locales: vec![],
58
extra_data: None,
···
102
103
let def = LabelValueDefinition {
104
identifier: CowStr::from("test-label"),
105
-
blurs: CowStr::from("content"),
106
-
severity: CowStr::from("alert"),
107
-
default_setting: Some(CowStr::from("hide")),
108
adult_only: Some(false),
109
locales: vec![],
110
extra_data: None,
···
221
// Media blur
222
let media_def = LabelValueDefinition {
223
identifier: CowStr::from("media-label"),
224
-
blurs: CowStr::from("media"),
225
-
severity: CowStr::from("alert"),
226
-
default_setting: Some(CowStr::from("warn")),
227
adult_only: Some(false),
228
locales: vec![],
229
extra_data: None,
···
232
// Content blur
233
let content_def = LabelValueDefinition {
234
identifier: CowStr::from("content-label"),
235
-
blurs: CowStr::from("content"),
236
-
severity: CowStr::from("alert"),
237
-
default_setting: Some(CowStr::from("warn")),
238
adult_only: Some(false),
239
locales: vec![],
240
extra_data: None,
···
301
302
let adult_def = LabelValueDefinition {
303
identifier: CowStr::from("adult-label"),
304
-
blurs: CowStr::from("content"),
305
-
severity: CowStr::from("alert"),
306
-
default_setting: Some(CowStr::from("warn")),
307
adult_only: Some(true),
308
locales: vec![],
309
extra_data: None,
···
4
};
5
use jacquard_api::app_bsky::feed::FeedViewPost;
6
use jacquard_api::app_bsky::labeler::get_services::GetServicesOutput;
7
+
use jacquard_api::com_atproto::label::{
8
+
Label, LabelValueDefinition, LabelValueDefinitionBlurs, LabelValueDefinitionDefaultSetting,
9
+
LabelValueDefinitionSeverity,
10
+
};
11
use jacquard_common::CowStr;
12
use jacquard_common::types::string::{Datetime, Did, Uri};
13
use serde::Deserialize;
···
53
// Create a label definition with defaultSetting: "hide"
54
let spam_def = LabelValueDefinition {
55
identifier: CowStr::from("spam"),
56
+
blurs: LabelValueDefinitionBlurs::Content,
57
+
severity: LabelValueDefinitionSeverity::Inform,
58
+
default_setting: Some(LabelValueDefinitionDefaultSetting::Hide),
59
adult_only: Some(false),
60
locales: vec![],
61
extra_data: None,
···
105
106
let def = LabelValueDefinition {
107
identifier: CowStr::from("test-label"),
108
+
blurs: LabelValueDefinitionBlurs::Content,
109
+
severity: LabelValueDefinitionSeverity::Alert,
110
+
default_setting: Some(LabelValueDefinitionDefaultSetting::Hide),
111
adult_only: Some(false),
112
locales: vec![],
113
extra_data: None,
···
224
// Media blur
225
let media_def = LabelValueDefinition {
226
identifier: CowStr::from("media-label"),
227
+
blurs: LabelValueDefinitionBlurs::Media,
228
+
severity: LabelValueDefinitionSeverity::Alert,
229
+
default_setting: Some(LabelValueDefinitionDefaultSetting::Warn),
230
adult_only: Some(false),
231
locales: vec![],
232
extra_data: None,
···
235
// Content blur
236
let content_def = LabelValueDefinition {
237
identifier: CowStr::from("content-label"),
238
+
blurs: LabelValueDefinitionBlurs::Content,
239
+
severity: LabelValueDefinitionSeverity::Alert,
240
+
default_setting: Some(LabelValueDefinitionDefaultSetting::Warn),
241
adult_only: Some(false),
242
locales: vec![],
243
extra_data: None,
···
304
305
let adult_def = LabelValueDefinition {
306
identifier: CowStr::from("adult-label"),
307
+
blurs: LabelValueDefinitionBlurs::Content,
308
+
severity: LabelValueDefinitionSeverity::Alert,
309
+
default_setting: Some(LabelValueDefinitionDefaultSetting::Warn),
310
adult_only: Some(true),
311
locales: vec![],
312
extra_data: None,
+14
-17
examples/subscribe_repos.rs
+14
-17
examples/subscribe_repos.rs
···
8
9
use clap::Parser;
10
use jacquard::api::com_atproto::sync::subscribe_repos::{SubscribeRepos, SubscribeReposMessage};
11
-
use jacquard_api::com_atproto::sync::subscribe_repos::RepoOp;
12
use jacquard_common::xrpc::{SubscriptionClient, TungsteniteSubscriptionClient};
13
use miette::IntoDiagnostic;
14
use n0_future::StreamExt;
···
45
fn print_message(msg: &SubscribeReposMessage) {
46
match msg {
47
SubscribeReposMessage::Commit(commit) => {
48
-
if commit.ops.iter().any(|op| op.action == "delete") {
49
-
println!(
50
-
"Commit | repo={} seq={} time={} rev={} commit={} ops={:?} prev={}",
51
-
commit.repo,
52
-
commit.seq,
53
-
commit.time,
54
-
commit.rev,
55
-
commit.commit,
56
-
commit.ops,
57
-
commit
58
-
.since
59
-
.as_ref()
60
-
.map(|ts| ts.to_smolstr())
61
-
.unwrap_or_default(),
62
-
);
63
-
}
64
}
65
SubscribeReposMessage::Identity(identity) => {
66
println!(
···
8
9
use clap::Parser;
10
use jacquard::api::com_atproto::sync::subscribe_repos::{SubscribeRepos, SubscribeReposMessage};
11
use jacquard_common::xrpc::{SubscriptionClient, TungsteniteSubscriptionClient};
12
use miette::IntoDiagnostic;
13
use n0_future::StreamExt;
···
44
fn print_message(msg: &SubscribeReposMessage) {
45
match msg {
46
SubscribeReposMessage::Commit(commit) => {
47
+
println!(
48
+
"Commit | repo={} seq={} time={} rev={} commit={} prev={}\n | ops={:?} ",
49
+
commit.repo,
50
+
commit.seq,
51
+
commit.time,
52
+
commit.rev,
53
+
commit.commit,
54
+
commit
55
+
.since
56
+
.as_ref()
57
+
.map(|ts| ts.to_smolstr())
58
+
.unwrap_or_default(),
59
+
commit.ops,
60
+
);
61
}
62
SubscribeReposMessage::Identity(identity) => {
63
println!(