summaryrefslogtreecommitdiffstats
path: root/server/src/apub/community.rs
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2020-04-08 14:37:05 +0200
committerFelix Ableitner <me@nutomic.com>2020-04-08 14:37:05 +0200
commit6962b9c43353e9fc5953ccdcfbe8f68efb3db04f (patch)
tree6d741ca863d09a352af7612aa7112e4ccbb0f60d /server/src/apub/community.rs
parentedd0ef5991689c55ac3a88462836dc0213093f46 (diff)
Use Url instead of String
Diffstat (limited to 'server/src/apub/community.rs')
-rw-r--r--server/src/apub/community.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs
index 83895196..444ee440 100644
--- a/server/src/apub/community.rs
+++ b/server/src/apub/community.rs
@@ -22,6 +22,7 @@ use diesel::r2d2::{ConnectionManager, Pool};
use diesel::PgConnection;
use failure::Error;
use serde::Deserialize;
+use url::Url;
#[derive(Deserialize)]
pub struct CommunityQuery {
@@ -87,16 +88,14 @@ impl Community {
impl CommunityForm {
pub fn from_group(group: &GroupExt, conn: &PgConnection) -> Result<Self, Error> {
- let followers_uri = &group.extension.get_followers().unwrap().to_string();
- let outbox_uri = &group.extension.get_outbox().to_string();
- let _outbox = fetch_remote_object::<OrderedCollection>(outbox_uri)?;
- let _followers = fetch_remote_object::<UnorderedCollection>(followers_uri)?;
+ let followers_uri = Url::parse(&group.extension.get_followers().unwrap().to_string())?;
+ let outbox_uri = Url::parse(&group.extension.get_outbox().to_string())?;
+ let _outbox = fetch_remote_object::<OrderedCollection>(&outbox_uri)?;
+ let _followers = fetch_remote_object::<UnorderedCollection>(&followers_uri)?;
let oprops = &group.base.object_props;
let aprops = &group.extension;
- let creator = fetch_remote_user(
- &oprops.get_attributed_to_xsd_any_uri().unwrap().to_string(),
- conn,
- )?;
+ let apub_id = Url::parse(&oprops.get_attributed_to_xsd_any_uri().unwrap().to_string())?;
+ let creator = fetch_remote_user(&apub_id, conn)?;
Ok(CommunityForm {
name: oprops.get_name_xsd_string().unwrap().to_string(),
title: aprops.get_preferred_username().unwrap().to_string(),