From e7d13958d891059abb735ead8009f9b3e6cc9579 Mon Sep 17 00:00:00 2001 From: Felix Date: Thu, 12 Mar 2020 03:35:32 +0100 Subject: [PATCH] Federate follower count, use string id for community --- docker/federation-test/docker-compose.yml | 4 ++-- server/src/apub/community.rs | 2 +- server/src/apub/puller.rs | 28 +++++++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docker/federation-test/docker-compose.yml b/docker/federation-test/docker-compose.yml index 39079d106..464d70812 100644 --- a/docker/federation-test/docker-compose.yml +++ b/docker/federation-test/docker-compose.yml @@ -6,7 +6,7 @@ services: ports: - "127.0.0.1:8540:8540" environment: - - LEMMY_HOSTNAME=localhost:8540 + - LEMMY_HOSTNAME=lemmy_alpha:8540 - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_alpha:5432/lemmy - LEMMY_JWT_SECRET=changeme - LEMMY_FRONT_END_DIR=/app/dist @@ -32,7 +32,7 @@ services: ports: - "127.0.0.1:8541:8541" environment: - - LEMMY_HOSTNAME=localhost:8541 + - LEMMY_HOSTNAME=lemmy_beta:8541 - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_beta:5432/lemmy - LEMMY_JWT_SECRET=changeme - LEMMY_FRONT_END_DIR=/app/dist diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs index bbb9da6ec..b5b365d0f 100644 --- a/server/src/apub/community.rs +++ b/server/src/apub/community.rs @@ -15,7 +15,7 @@ use serde::Deserialize; impl Community { pub fn as_group(&self) -> Result { - let base_url = make_apub_endpoint("c", &self.id); + let base_url = make_apub_endpoint("c", &self.name); let mut group = Group::default(); let oprops: &mut ObjectProperties = group.as_mut(); diff --git a/server/src/apub/puller.rs b/server/src/apub/puller.rs index 1465415b6..aa34ce500 100644 --- a/server/src/apub/puller.rs +++ b/server/src/apub/puller.rs @@ -2,10 +2,10 @@ extern crate reqwest; use crate::api::community::{GetCommunityResponse, ListCommunitiesResponse}; use crate::api::post::GetPosts; -use crate::apub::parse_apub_endpoint; use crate::db::community_view::CommunityView; use crate::settings::Settings; use activitystreams::actor::apub::Group; +use activitystreams::collection::apub::UnorderedCollection; use failure::Error; // TODO: right now all of the data is requested on demand, for production we will need to store @@ -38,6 +38,12 @@ pub fn get_remote_community(identifier: String) -> Result Result()?, + id: -1, //community.object_props.get_id() name, title: community .object_props @@ -60,15 +64,7 @@ pub fn get_remote_community(identifier: String) -> Result()?, + creator_id: -1, //community.object_props.get_attributed_to_xsd_any_uri() removed: false, published: community .object_props @@ -86,7 +82,11 @@ pub fn get_remote_community(identifier: String) -> Result