diff options
author | Felix <me@nutomic.com> | 2020-05-14 14:26:44 +0200 |
---|---|---|
committer | Felix <me@nutomic.com> | 2020-05-14 14:26:44 +0200 |
commit | 11acc7225eaa4d0fac9c6168c3d1cb4c80a56e41 (patch) | |
tree | fe6025f811ce90b060b2776ff55e0a32cc52e26a /server/src/apub/community.rs | |
parent | a1ad21ec56dea6926329f3e56fcc7d9817557b57 (diff) |
Add helper function for Activity::create()
Diffstat (limited to 'server/src/apub/community.rs')
-rw-r--r-- | server/src/apub/community.rs | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs index 5e158d5c..03be220d 100644 --- a/server/src/apub/community.rs +++ b/server/src/apub/community.rs @@ -100,14 +100,7 @@ impl ActorType for Community { .set_object_base_box(BaseBox::from_concrete(follow.clone())?)?; let to = format!("{}/inbox", actor_uri); - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: self.creator_id, - data: serde_json::to_value(&accept)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, self.creator_id, &accept, true)?; send_activity( &accept, @@ -130,14 +123,7 @@ impl ActorType for Community { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(group)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: self.creator_id, - data: serde_json::to_value(&delete)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, self.creator_id, &delete, true)?; // Note: For an accept, since it was automatic, no one pushed a button, // the community was the actor. @@ -175,14 +161,7 @@ impl ActorType for Community { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(delete)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: self.creator_id, - data: serde_json::to_value(&undo)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, self.creator_id, &undo, true)?; // Note: For an accept, since it was automatic, no one pushed a button, // the community was the actor. @@ -208,14 +187,7 @@ impl ActorType for Community { .set_actor_xsd_any_uri(mod_.actor_id.to_owned())? .set_object_base_box(group)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: mod_.id, - data: serde_json::to_value(&remove)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, mod_.id, &remove, true)?; // Note: For an accept, since it was automatic, no one pushed a button, // the community was the actor. @@ -252,14 +224,7 @@ impl ActorType for Community { .set_actor_xsd_any_uri(mod_.actor_id.to_owned())? .set_object_base_box(remove)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: mod_.id, - data: serde_json::to_value(&undo)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, mod_.id, &undo, true)?; // Note: For an accept, since it was automatic, no one pushed a button, // the community was the actor. |