Update activitystreams library to latest version #71
|
@ -10,12 +10,10 @@ use crate::{
|
||||||
routes::DbPoolParam,
|
routes::DbPoolParam,
|
||||||
DbPool, LemmyError,
|
DbPool, LemmyError,
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::Announce, BaseBox};
|
use activitystreams::{activity::Announce, Activity, Base, BaseBox};
|
||||||
use activitystreams::{Activity, Base};
|
|
||||||
use activitystreams_ext::Ext2;
|
use activitystreams_ext::Ext2;
|
||||||
use activitystreams_new::{
|
use activitystreams_new::{
|
||||||
activity::Follow,
|
activity::{Accept, Delete, Follow, Remove, Undo},
|
||||||
activity::{Accept, Delete, Remove, Undo},
|
|
||||||
actor::{kind::GroupType, ApActor, Endpoints, Group},
|
actor::{kind::GroupType, ApActor, Endpoints, Group},
|
||||||
base::BaseExt,
|
base::BaseExt,
|
||||||
collection::UnorderedCollection,
|
collection::UnorderedCollection,
|
||||||
|
|
|
@ -8,8 +8,10 @@ use crate::{
|
||||||
routes::{ChatServerParam, DbPoolParam},
|
routes::{ChatServerParam, DbPoolParam},
|
||||||
LemmyError,
|
LemmyError,
|
||||||
};
|
};
|
||||||
use activitystreams::activity::Undo;
|
use activitystreams_new::{
|
||||||
use activitystreams_new::activity::Follow;
|
activity::{Follow, Undo},
|
||||||
|
prelude::*,
|
||||||
|
};
|
||||||
use actix_web::{client::Client, web, HttpRequest, HttpResponse};
|
use actix_web::{client::Client, web, HttpRequest, HttpResponse};
|
||||||
use lemmy_db::{
|
use lemmy_db::{
|
||||||
community::{Community, CommunityFollower, CommunityFollowerForm},
|
community::{Community, CommunityFollower, CommunityFollowerForm},
|
||||||
|
@ -31,14 +33,9 @@ impl CommunityAcceptedObjects {
|
||||||
fn follow(&self) -> Result<Follow, LemmyError> {
|
fn follow(&self) -> Result<Follow, LemmyError> {
|
||||||
match self {
|
match self {
|
||||||
CommunityAcceptedObjects::Follow(f) => Ok(f.to_owned()),
|
CommunityAcceptedObjects::Follow(f) => Ok(f.to_owned()),
|
||||||
CommunityAcceptedObjects::Undo(u) => Ok(
|
CommunityAcceptedObjects::Undo(u) => {
|
||||||
u.undo_props
|
Ok(Follow::from_any_base(u.object.as_one().unwrap().to_owned())?.unwrap())
|
||||||
.get_object_base_box()
|
}
|
||||||
.to_owned()
|
|
||||||
.unwrap()
|
|
||||||
.to_owned()
|
|
||||||
.into_concrete::<Follow>()?,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,12 @@ use crate::{
|
||||||
},
|
},
|
||||||
blocking, DbPool, LemmyError,
|
blocking, DbPool, LemmyError,
|
||||||
};
|
};
|
||||||
use activitystreams_new::object::kind::NoteType;
|
|
||||||
use activitystreams_new::object::{Note, Tombstone};
|
|
||||||
use activitystreams_new::primitives::{XsdAnyUri, XsdDateTime};
|
|
||||||
use activitystreams_new::{
|
use activitystreams_new::{
|
||||||
activity::{Create, Delete, Undo, Update},
|
activity::{Create, Delete, Undo, Update},
|
||||||
context,
|
context,
|
||||||
|
object::{kind::NoteType, Note, Tombstone},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
primitives::{XsdAnyUri, XsdDateTime},
|
||||||
};
|
};
|
||||||
use actix_web::client::Client;
|
use actix_web::client::Client;
|
||||||
use lemmy_db::{
|
use lemmy_db::{
|
||||||
|
|
|
@ -10,8 +10,11 @@ use crate::{
|
||||||
websocket::{server::SendUserRoomMessage, UserOperation},
|
websocket::{server::SendUserRoomMessage, UserOperation},
|
||||||
DbPool, LemmyError,
|
DbPool, LemmyError,
|
||||||
};
|
};
|
||||||
use activitystreams::activity::{Accept, Create, Delete, Undo, Update};
|
use activitystreams_new::{
|
||||||
use activitystreams_new::object::Note;
|
activity::{Accept, Create, Delete, Undo, Update},
|
||||||
|
object::Note,
|
||||||
|
prelude::*,
|
||||||
|
};
|
||||||
use actix_web::{client::Client, web, HttpRequest, HttpResponse};
|
use actix_web::{client::Client, web, HttpRequest, HttpResponse};
|
||||||
use lemmy_db::{
|
use lemmy_db::{
|
||||||
community::{CommunityFollower, CommunityFollowerForm},
|
community::{CommunityFollower, CommunityFollowerForm},
|
||||||
|
@ -75,8 +78,9 @@ async fn receive_accept(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
let community_uri = accept
|
let community_uri = accept
|
||||||
.accept_props
|
.actor()
|
||||||
.get_actor_xsd_any_uri()
|
.to_owned()
|
||||||
|
.single_xsd_any_uri()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
|
@ -111,17 +115,10 @@ async fn receive_create_private_message(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
chat_server: ChatServerParam,
|
chat_server: ChatServerParam,
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
let note = create
|
let user_uri = &create.actor().to_owned().single_xsd_any_uri().unwrap();
|
||||||
.create_props
|
let note = Note::from_any_base(create.object.as_one().unwrap().to_owned())?.unwrap();
|
||||||
.get_object_base_box()
|
|
||||||
.to_owned()
|
|
||||||
.unwrap()
|
|
||||||
.to_owned()
|
|
||||||
.into_concrete::<Note>()?;
|
|
||||||
|
|
||||||
let user_uri = create.create_props.get_actor_xsd_any_uri().unwrap();
|
let user = get_or_fetch_and_upsert_remote_user(user_uri, client, pool).await?;
|
||||||
|
|
||||||
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
|
||||||
verify(request, &user)?;
|
verify(request, &user)?;
|
||||||
|
|
||||||
insert_activity(user.id, create, false, pool).await?;
|
insert_activity(user.id, create, false, pool).await?;
|
||||||
|
@ -159,15 +156,8 @@ async fn receive_update_private_message(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
chat_server: ChatServerParam,
|
chat_server: ChatServerParam,
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
let note = update
|
let user_uri = update.actor().to_owned().single_xsd_any_uri().unwrap();
|
||||||
.update_props
|
let note = Note::from_any_base(update.object.as_one().unwrap().to_owned())?.unwrap();
|
||||||
.get_object_base_box()
|
|
||||||
.to_owned()
|
|
||||||
.unwrap()
|
|
||||||
.to_owned()
|
|
||||||
.into_concrete::<Note>()?;
|
|
||||||
|
|
||||||
let user_uri = update.update_props.get_actor_xsd_any_uri().unwrap();
|
|
||||||
|
|
||||||
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
||||||
verify(request, &user)?;
|
verify(request, &user)?;
|
||||||
|
@ -215,15 +205,8 @@ async fn receive_delete_private_message(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
chat_server: ChatServerParam,
|
chat_server: ChatServerParam,
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
let note = delete
|
let user_uri = delete.actor().to_owned().single_xsd_any_uri().unwrap();
|
||||||
.delete_props
|
let note = Note::from_any_base(delete.object.as_one().unwrap().to_owned())?.unwrap();
|
||||||
.get_object_base_box()
|
|
||||||
.to_owned()
|
|
||||||
.unwrap()
|
|
||||||
.to_owned()
|
|
||||||
.into_concrete::<Note>()?;
|
|
||||||
|
|
||||||
let user_uri = delete.delete_props.get_actor_xsd_any_uri().unwrap();
|
|
||||||
|
|
||||||
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
||||||
verify(request, &user)?;
|
verify(request, &user)?;
|
||||||
|
@ -283,23 +266,9 @@ async fn receive_undo_delete_private_message(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
chat_server: ChatServerParam,
|
chat_server: ChatServerParam,
|
||||||
) -> Result<HttpResponse, LemmyError> {
|
) -> Result<HttpResponse, LemmyError> {
|
||||||
let delete = undo
|
let delete = Delete::from_any_base(undo.object.as_one().unwrap().to_owned())?.unwrap();
|
||||||
.undo_props
|
let note = Note::from_any_base(delete.object.as_one().unwrap().to_owned())?.unwrap();
|
||||||
.get_object_base_box()
|
let user_uri = delete.actor().to_owned().single_xsd_any_uri().unwrap();
|
||||||
.to_owned()
|
|
||||||
.unwrap()
|
|
||||||
.to_owned()
|
|
||||||
.into_concrete::<Delete>()?;
|
|
||||||
|
|
||||||
let note = delete
|
|
||||||
.delete_props
|
|
||||||
.get_object_base_box()
|
|
||||||
.to_owned()
|
|
||||||
.unwrap()
|
|
||||||
.to_owned()
|
|
||||||
.into_concrete::<Note>()?;
|
|
||||||
|
|
||||||
let user_uri = delete.delete_props.get_actor_xsd_any_uri().unwrap();
|
|
||||||
|
|
||||||
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
let user = get_or_fetch_and_upsert_remote_user(&user_uri, client, pool).await?;
|
||||||
verify(request, &user)?;
|
verify(request, &user)?;
|
||||||
|
|
Loading…
Reference in New Issue