mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
fix: make sensitive in AP optional bc AP
This commit is contained in:
parent
f5e4092bca
commit
474b57652b
|
|
@ -305,7 +305,7 @@ pub async fn receive_lysand_note(
|
||||||
let ap_note = crate::objects::post::Note {
|
let ap_note = crate::objects::post::Note {
|
||||||
kind: Default::default(),
|
kind: Default::default(),
|
||||||
id,
|
id,
|
||||||
sensitive: note.is_sensitive.unwrap_or(false),
|
sensitive: Some(note.is_sensitive.unwrap_or(false)),
|
||||||
cc,
|
cc,
|
||||||
to,
|
to,
|
||||||
tag,
|
tag,
|
||||||
|
|
@ -336,7 +336,7 @@ pub async fn receive_lysand_note(
|
||||||
id: Set(note.id.to_string()),
|
id: Set(note.id.to_string()),
|
||||||
creator: Set(lysand_author.id.clone()),
|
creator: Set(lysand_author.id.clone()),
|
||||||
content: Set(ap_note.content.clone()),
|
content: Set(ap_note.content.clone()),
|
||||||
sensitive: Set(ap_note.sensitive),
|
sensitive: Set(ap_note.sensitive.unwrap_or_default()),
|
||||||
created_at: Set(Utc
|
created_at: Set(Utc
|
||||||
.timestamp_micros(note.created_at.unix_timestamp())
|
.timestamp_micros(note.created_at.unix_timestamp())
|
||||||
.unwrap()),
|
.unwrap()),
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ async fn post_manually(
|
||||||
let note = Note {
|
let note = Note {
|
||||||
kind: Default::default(),
|
kind: Default::default(),
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
sensitive: false,
|
sensitive: Some(false),
|
||||||
attributed_to: Url::parse(&local_user.id).unwrap().into(),
|
attributed_to: Url::parse(&local_user.id).unwrap().into(),
|
||||||
to: vec![public(), mention.href.clone()],
|
to: vec![public(), mention.href.clone()],
|
||||||
content: format!("{} {}", path.1, target.name),
|
content: format!("{} {}", path.1, target.name),
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ pub struct Note {
|
||||||
pub(crate) content: String,
|
pub(crate) content: String,
|
||||||
pub(crate) in_reply_to: Option<ObjectId<post::Model>>,
|
pub(crate) in_reply_to: Option<ObjectId<post::Model>>,
|
||||||
pub(crate) tag: Vec<Mention>,
|
pub(crate) tag: Vec<Mention>,
|
||||||
pub(crate) sensitive: bool,
|
pub(crate) sensitive: Option<bool>,
|
||||||
pub(crate) cc: Option<Vec<Url>>,
|
pub(crate) cc: Option<Vec<Url>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ impl Object for post::Model {
|
||||||
content: self.content,
|
content: self.content,
|
||||||
in_reply_to: None,
|
in_reply_to: None,
|
||||||
tag: vec![],
|
tag: vec![],
|
||||||
sensitive: self.sensitive,
|
sensitive: Some(self.sensitive),
|
||||||
cc: Some(to),
|
cc: Some(to),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +126,7 @@ impl Object for post::Model {
|
||||||
content_type: Set("text/plain".to_string()), // TODO: make this use the real content type
|
content_type: Set("text/plain".to_string()), // TODO: make this use the real content type
|
||||||
local: Set(false),
|
local: Set(false),
|
||||||
visibility: Set("public".to_string()), // TODO: make this use the real visibility
|
visibility: Set("public".to_string()), // TODO: make this use the real visibility
|
||||||
sensitive: Set(json.sensitive.clone()),
|
sensitive: Set(json.sensitive.clone().unwrap_or_default()),
|
||||||
url: Set(json.id.clone().to_string()),
|
url: Set(json.id.clone().to_string()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue