diff options
Diffstat (limited to 'server/src/apub/comment.rs')
-rw-r--r-- | server/src/apub/comment.rs | 81 |
1 files changed, 9 insertions, 72 deletions
diff --git a/server/src/apub/comment.rs b/server/src/apub/comment.rs index 17da45a6..9160c7ef 100644 --- a/server/src/apub/comment.rs +++ b/server/src/apub/comment.rs @@ -113,14 +113,7 @@ impl ApubObjectType for Comment { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(note)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: creator.id, - data: serde_json::to_value(&create)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &create, true)?; send_activity( &create, @@ -149,14 +142,7 @@ impl ApubObjectType for Comment { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(note)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: creator.id, - data: serde_json::to_value(&update)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &update, true)?; send_activity( &update, @@ -185,14 +171,7 @@ impl ApubObjectType for Comment { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(note)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: creator.id, - data: serde_json::to_value(&delete)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &delete, true)?; send_activity( &delete, @@ -239,14 +218,7 @@ impl ApubObjectType for Comment { .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: creator.id, - data: serde_json::to_value(&undo)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &undo, true)?; send_activity( &undo, @@ -275,14 +247,7 @@ impl ApubObjectType for Comment { .set_actor_xsd_any_uri(mod_.actor_id.to_owned())? .set_object_base_box(note)?; - // 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)?; send_activity( &remove, @@ -328,14 +293,7 @@ impl ApubObjectType for Comment { .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)?; send_activity( &undo, @@ -361,14 +319,7 @@ impl ApubLikeableType for Comment { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(note)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: creator.id, - data: serde_json::to_value(&like)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &like, true)?; send_activity( &like, @@ -396,14 +347,7 @@ impl ApubLikeableType for Comment { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(note)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: creator.id, - data: serde_json::to_value(&dislike)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &dislike, true)?; send_activity( &dislike, @@ -443,14 +387,7 @@ impl ApubLikeableType for Comment { .set_actor_xsd_any_uri(creator.actor_id.to_owned())? .set_object_base_box(like)?; - // Insert the sent activity into the activity table - let activity_form = activity::ActivityForm { - user_id: creator.id, - data: serde_json::to_value(&undo)?, - local: true, - updated: None, - }; - activity::Activity::create(&conn, &activity_form)?; + insert_activity(&conn, creator.id, &undo, true)?; send_activity( &undo, |