mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 11:21:32 +00:00
remove outdated comments
This commit is contained in:
parent
66142c546b
commit
a1ad21ec56
5 changed files with 2 additions and 72 deletions
|
@ -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) {
|
||||
|
|
|
@ -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::<OrderedCollection>(&outbox_uri)?;
|
||||
// let _followers = fetch_remote_object::<UnorderedCollection>(&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<CommunityQuery>,
|
||||
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<CommunityQuery>,
|
||||
// db: DbPoolParam,
|
||||
// chat_server: ChatServerParam,
|
||||
//) -> Result<HttpResponse<Body>, 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> = 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))
|
||||
//}
|
||||
|
|
|
@ -197,26 +197,3 @@ fn upsert_post(post_form: &PostForm, conn: &PgConnection) -> Result<Post, Error>
|
|||
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<Vec<Post>, Error> {
|
||||
// let outbox_url = Url::parse(&community.get_outbox_url())?;
|
||||
// let outbox = fetch_remote_object::<OrderedCollection>(&outbox_url)?;
|
||||
// let items = outbox.collection_props.get_many_items_base_boxes();
|
||||
|
||||
// Ok(
|
||||
// items
|
||||
// .unwrap()
|
||||
// .map(|obox: &BaseBox| -> Result<PostForm, Error> {
|
||||
// let page = obox.clone().to_concrete::<Page>()?;
|
||||
// PostForm::from_page(&page, conn)
|
||||
// })
|
||||
// .map(|pf| upsert_post(&pf?, conn))
|
||||
// .collect::<Result<Vec<Post>, Error>>()?,
|
||||
// )
|
||||
// }
|
||||
|
|
|
@ -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<Self::Response, Error>;
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue