summaryrefslogtreecommitdiffstats
path: root/server/src/apub/post.rs
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-04-28 00:16:02 -0400
committerDessalines <tyhou13@gmx.com>2020-04-28 00:16:02 -0400
commit3b62f58dd2ee8dc9e3d5fec15a48df052f164deb (patch)
treef27be37eac62da270fb3ff1d18bb2e7847acd1de /server/src/apub/post.rs
parent6eaa06ab02a20c359b88a8c6a36ca3c668761825 (diff)
Adding federated post and comment likes.
Diffstat (limited to 'server/src/apub/post.rs')
-rw-r--r--server/src/apub/post.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/server/src/apub/post.rs b/server/src/apub/post.rs
index 505ab98a..af8ee599 100644
--- a/server/src/apub/post.rs
+++ b/server/src/apub/post.rs
@@ -98,11 +98,13 @@ impl ApubObjectType for Post {
fn send_create(&self, creator: &User_, conn: &PgConnection) -> Result<(), Error> {
let page = self.to_apub(conn)?;
let community = Community::read(conn, self.community_id)?;
+ let id = format!("{}/create/{}", self.ap_id, uuid::Uuid::new_v4());
+
let mut create = Create::new();
populate_object_props(
&mut create.object_props,
&community.get_followers_url(),
- &self.ap_id,
+ &id,
)?;
create
.create_props
@@ -131,11 +133,13 @@ impl ApubObjectType for Post {
fn send_update(&self, creator: &User_, conn: &PgConnection) -> Result<(), Error> {
let page = self.to_apub(conn)?;
let community = Community::read(conn, self.community_id)?;
+ let id = format!("{}/update/{}", self.ap_id, uuid::Uuid::new_v4());
+
let mut update = Update::new();
populate_object_props(
&mut update.object_props,
&community.get_followers_url(),
- &self.ap_id,
+ &id,
)?;
update
.update_props
@@ -165,12 +169,10 @@ impl ApubLikeableType for Post {
fn send_like(&self, creator: &User_, conn: &PgConnection) -> Result<(), Error> {
let page = self.to_apub(conn)?;
let community = Community::read(conn, self.community_id)?;
+ let id = format!("{}/like/{}", self.ap_id, uuid::Uuid::new_v4());
+
let mut like = Like::new();
- populate_object_props(
- &mut like.object_props,
- &community.get_followers_url(),
- &self.ap_id,
- )?;
+ populate_object_props(&mut like.object_props, &community.get_followers_url(), &id)?;
like
.like_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
@@ -197,11 +199,13 @@ impl ApubLikeableType for Post {
fn send_dislike(&self, creator: &User_, conn: &PgConnection) -> Result<(), Error> {
let page = self.to_apub(conn)?;
let community = Community::read(conn, self.community_id)?;
+ let id = format!("{}/dislike/{}", self.ap_id, uuid::Uuid::new_v4());
+
let mut dislike = Dislike::new();
populate_object_props(
&mut dislike.object_props,
&community.get_followers_url(),
- &self.ap_id,
+ &id,
)?;
dislike
.dislike_props