Follow activities don't have dates

This commit is contained in:
Bat 2018-05-03 22:01:20 +01:00
parent b10af9776b
commit 8ce44d7654

View File

@ -96,8 +96,7 @@ impl Activity for Create {
pub struct Follow { pub struct Follow {
id: String, id: String,
actor: serde_json::Value, actor: serde_json::Value,
object: serde_json::Value, object: serde_json::Value
date: chrono::DateTime<chrono::Utc>
} }
impl Follow { impl Follow {
@ -105,8 +104,7 @@ impl Follow {
Follow { Follow {
id: format!("{}/follow/{}", follower.compute_id(conn), following.compute_id(conn)), id: format!("{}/follow/{}", follower.compute_id(conn), following.compute_id(conn)),
actor: serde_json::Value::String(follower.compute_id(conn)), actor: serde_json::Value::String(follower.compute_id(conn)),
object: serde_json::Value::String(following.compute_id(conn)), object: serde_json::Value::String(following.compute_id(conn))
date: chrono::Utc::now()
} }
} }
@ -114,8 +112,7 @@ impl Follow {
Follow { Follow {
id: json["id"].as_str().unwrap().to_string(), id: json["id"].as_str().unwrap().to_string(),
actor: json["actor"].clone(), actor: json["actor"].clone(),
object: json["object"].clone(), object: json["object"].clone()
date: chrono::DateTime::from_str(json["published"].as_str().unwrap()).unwrap()
} }
} }
@ -137,8 +134,7 @@ impl Activity for Follow {
json!({ json!({
"type": "Follow", "type": "Follow",
"actor": self.actor, "actor": self.actor,
"object": self.object, "object": self.object
"published": self.date.to_rfc3339()
}) })
} }
} }