mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
Refactor Note struct in post.rs to remove url and published fields
This commit is contained in:
parent
19291bc107
commit
a06414f0bd
|
|
@ -39,8 +39,6 @@ pub struct Note {
|
||||||
content: String,
|
content: String,
|
||||||
in_reply_to: Option<ObjectId<post::Model>>,
|
in_reply_to: Option<ObjectId<post::Model>>,
|
||||||
tag: Vec<Mention>,
|
tag: Vec<Mention>,
|
||||||
url: String,
|
|
||||||
published: String,
|
|
||||||
sensitive: bool,
|
sensitive: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +90,7 @@ impl Object for post::Model {
|
||||||
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()),
|
||||||
url: Set(json.url.clone()),
|
url: Set(json.id.clone().to_string()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let post = post
|
let post = post
|
||||||
|
|
@ -114,10 +112,8 @@ impl Object for post::Model {
|
||||||
let id: ObjectId<post::Model> = generate_object_id(data.domain())?.into();
|
let id: ObjectId<post::Model> = generate_object_id(data.domain())?.into();
|
||||||
let note = Note {
|
let note = Note {
|
||||||
kind: Default::default(),
|
kind: Default::default(),
|
||||||
url: id.clone().to_string(),
|
|
||||||
id,
|
id,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
published: chrono::Utc::now().to_rfc3339(),
|
|
||||||
attributed_to: Url::parse(&data.local_user().await?.id).unwrap().into(),
|
attributed_to: Url::parse(&data.local_user().await?.id).unwrap().into(),
|
||||||
to: vec![public()],
|
to: vec![public()],
|
||||||
content: format!("Hello {}", creator.name),
|
content: format!("Hello {}", creator.name),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue