From: Felix Date: Thu, 14 May 2020 11:23:56 +0000 (+0200) Subject: remove outdated comments X-Git-Url: http://these/git/readmes/%7B%60https:/%22https:/hacktivis.me/static/%24%7Bsrc%7D?a=commitdiff_plain;h=a1ad21ec56dea6926329f3e56fcc7d9817557b57;p=lemmy.git remove outdated comments --- diff --git a/server/src/apub/activities.rs b/server/src/apub/activities.rs index 517fd248..6903d175 100644 --- a/server/src/apub/activities.rs +++ b/server/src/apub/activities.rs @@ -28,8 +28,6 @@ where { let json = serde_json::to_string(&activity)?; debug!("Sending activitypub activity {} to {:?}", json, to); - // TODO it needs to expand, the to field needs to expand and dedup the followers urls - // The inbox is determined by first retrieving the target actor's JSON-LD representation and then looking up the inbox property. If a recipient is a Collection or OrderedCollection, then the server MUST dereference the collection (with the user's credentials) and discover inboxes for each item in the collection. Servers MUST limit the number of layers of indirections through collections which will be performed, which MAY be one. for t in to { let to_url = Url::parse(&t)?; if !is_apub_id_valid(&to_url) { diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs index f7cd213d..5e158d5c 100644 --- a/server/src/apub/community.rs +++ b/server/src/apub/community.rs @@ -316,11 +316,6 @@ impl FromApub for CommunityForm { let aprops = &group.base.extension; let public_key: &PublicKey = &group.extension.public_key; - let _followers_uri = Url::parse(&aprops.get_followers().unwrap().to_string())?; - let _outbox_uri = Url::parse(&aprops.get_outbox().to_string())?; - // TODO don't do extra fetching here - // let _outbox = fetch_remote_object::(&outbox_uri)?; - // let _followers = fetch_remote_object::(&followers_uri)?; let mut creator_and_moderator_uris = oprops.get_many_attributed_to_xsd_any_uris().unwrap(); let creator = creator_and_moderator_uris .next() @@ -368,8 +363,7 @@ pub async fn get_apub_community_http( } } -/// Returns an empty followers collection, only populating the siz (for privacy). -// TODO this needs to return the actual followers, and the to: field needs this +/// Returns an empty followers collection, only populating the size (for privacy). pub async fn get_apub_community_followers( info: Path, db: DbPoolParam, @@ -391,34 +385,3 @@ pub async fn get_apub_community_followers( .set_total_items(community_followers.len() as u64)?; Ok(create_apub_response(&collection)) } - -// TODO should not be doing this -// Returns an UnorderedCollection with the latest posts from the community. -//pub async fn get_apub_community_outbox( -// info: Path, -// db: DbPoolParam, -// chat_server: ChatServerParam, -//) -> Result, Error> { -// let community = Community::read_from_name(&&db.get()?, &info.community_name)?; - -// let conn = establish_unpooled_connection(); -// //As we are an object, we validated that the community id was valid -// let community_posts: Vec = Post::list_for_community(&conn, community.id)?; - -// let mut collection = OrderedCollection::default(); -// let oprops: &mut ObjectProperties = collection.as_mut(); -// oprops -// .set_context_xsd_any_uri(context())? -// .set_id(community.actor_id)?; -// collection -// .collection_props -// .set_many_items_base_boxes( -// community_posts -// .iter() -// .map(|c| c.as_page(&conn).unwrap()) -// .collect(), -// )? -// .set_total_items(community_posts.len() as u64)?; - -// Ok(create_apub_response(&collection)) -//} diff --git a/server/src/apub/fetcher.rs b/server/src/apub/fetcher.rs index 115ef6ff..aa2a75ea 100644 --- a/server/src/apub/fetcher.rs +++ b/server/src/apub/fetcher.rs @@ -197,26 +197,3 @@ fn upsert_post(post_form: &PostForm, conn: &PgConnection) -> Result Err(e) => Err(Error::from(e)), } } - -// TODO It should not be fetching data from a community outbox. -// All posts, comments, comment likes, etc should be posts to our community_inbox -// The only data we should be periodically fetching (if it hasn't been fetched in the last day -// maybe), is community and user actors -// and user actors -// Fetch all posts in the outbox of the given user, and insert them into the database. -// fn fetch_community_outbox(community: &Community, conn: &PgConnection) -> Result, Error> { -// let outbox_url = Url::parse(&community.get_outbox_url())?; -// let outbox = fetch_remote_object::(&outbox_url)?; -// let items = outbox.collection_props.get_many_items_base_boxes(); - -// Ok( -// items -// .unwrap() -// .map(|obox: &BaseBox| -> Result { -// let page = obox.clone().to_concrete::()?; -// PostForm::from_page(&page, conn) -// }) -// .map(|pf| upsert_post(&pf?, conn)) -// .collect::, Error>>()?, -// ) -// } diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index 77950d41..a87c5c39 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -105,18 +105,12 @@ where .json(data) } -/// Generates the ActivityPub ID for a given object type and name. -/// -/// TODO: we will probably need to change apub endpoint urls so that html and activity+json content -/// types are handled at the same endpoint, so that you can copy the url into mastodon search -/// and have it fetch the object. +/// Generates the ActivityPub ID for a given object type and ID. pub fn make_apub_endpoint(endpoint_type: EndpointType, name: &str) -> Url { let point = match endpoint_type { EndpointType::Community => "c", EndpointType::User => "u", EndpointType::Post => "post", - // TODO I have to change this else my update advanced_migrations crashes the - // server if a comment exists. EndpointType::Comment => "comment", EndpointType::PrivateMessage => "private_message", }; @@ -157,7 +151,6 @@ fn is_apub_id_valid(apub_id: &Url) -> bool { } } -// TODO Not sure good names for these pub trait ToApub { type Response; fn to_apub(&self, conn: &PgConnection) -> Result; diff --git a/server/src/apub/user_inbox.rs b/server/src/apub/user_inbox.rs index 9c25d805..f1c449a5 100644 --- a/server/src/apub/user_inbox.rs +++ b/server/src/apub/user_inbox.rs @@ -78,7 +78,6 @@ fn receive_accept( CommunityFollower::follow(&conn, &community_follower_form)?; // TODO: make sure that we actually requested a follow - // TODO: at this point, indicate to the user that they are following the community Ok(HttpResponse::Ok().finish()) }