Fix problem that prevented viewing of pleroma user profiles
This commit is contained in:
parent
0af047dd83
commit
614490d29b
14 changed files with 76 additions and 64 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1728,6 +1728,7 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lemmy_api_common",
|
"lemmy_api_common",
|
||||||
"lemmy_apub",
|
"lemmy_apub",
|
||||||
|
"lemmy_apub_lib",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
"lemmy_db_views",
|
"lemmy_db_views",
|
||||||
"lemmy_db_views_actor",
|
"lemmy_db_views_actor",
|
||||||
|
|
|
@ -14,6 +14,7 @@ doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_apub = { version = "=0.13.5-rc.7", path = "../apub" }
|
lemmy_apub = { version = "=0.13.5-rc.7", path = "../apub" }
|
||||||
|
lemmy_apub_lib = { version = "=0.13.5-rc.7", path = "../apub_lib" }
|
||||||
lemmy_utils = { version = "=0.13.5-rc.7", path = "../utils" }
|
lemmy_utils = { version = "=0.13.5-rc.7", path = "../utils" }
|
||||||
lemmy_db_schema = { version = "=0.13.5-rc.7", path = "../db_schema" }
|
lemmy_db_schema = { version = "=0.13.5-rc.7", path = "../db_schema" }
|
||||||
lemmy_db_views = { version = "=0.13.5-rc.7", path = "../db_views" }
|
lemmy_db_views = { version = "=0.13.5-rc.7", path = "../db_views" }
|
||||||
|
|
|
@ -11,10 +11,10 @@ use lemmy_api_common::{
|
||||||
site::*,
|
site::*,
|
||||||
};
|
};
|
||||||
use lemmy_apub::{
|
use lemmy_apub::{
|
||||||
build_actor_id_from_shortname,
|
|
||||||
fetcher::search::{search_by_apub_id, SearchableObjects},
|
fetcher::search::{search_by_apub_id, SearchableObjects},
|
||||||
EndpointType,
|
get_actor_id_from_name,
|
||||||
};
|
};
|
||||||
|
use lemmy_apub_lib::webfinger::WebfingerType;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
from_opt_str_to_opt_enum,
|
from_opt_str_to_opt_enum,
|
||||||
newtypes::PersonId,
|
newtypes::PersonId,
|
||||||
|
@ -174,11 +174,13 @@ impl Perform for Search {
|
||||||
let listing_type: Option<ListingType> = from_opt_str_to_opt_enum(&data.listing_type);
|
let listing_type: Option<ListingType> = from_opt_str_to_opt_enum(&data.listing_type);
|
||||||
let search_type: SearchType = from_opt_str_to_opt_enum(&data.type_).unwrap_or(SearchType::All);
|
let search_type: SearchType = from_opt_str_to_opt_enum(&data.type_).unwrap_or(SearchType::All);
|
||||||
let community_id = data.community_id;
|
let community_id = data.community_id;
|
||||||
let community_actor_id = data
|
let community_actor_id = if let Some(name) = &data.community_name {
|
||||||
.community_name
|
get_actor_id_from_name(WebfingerType::Group, name, context)
|
||||||
.as_ref()
|
.await
|
||||||
.map(|t| build_actor_id_from_shortname(EndpointType::Community, t, &context.settings()).ok())
|
.ok()
|
||||||
.unwrap_or(None);
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
let creator_id = data.creator_id;
|
let creator_id = data.creator_id;
|
||||||
match search_type {
|
match search_type {
|
||||||
SearchType::Posts => {
|
SearchType::Posts => {
|
||||||
|
|
|
@ -17,7 +17,7 @@ use lemmy_apub::{
|
||||||
CreateOrUpdateType,
|
CreateOrUpdateType,
|
||||||
},
|
},
|
||||||
fetcher::post_or_comment::PostOrComment,
|
fetcher::post_or_comment::PostOrComment,
|
||||||
generate_apub_endpoint,
|
generate_local_apub_endpoint,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -109,7 +109,7 @@ impl PerformCrud for CreateComment {
|
||||||
|
|
||||||
let updated_comment: Comment =
|
let updated_comment: Comment =
|
||||||
blocking(context.pool(), move |conn| -> Result<Comment, LemmyError> {
|
blocking(context.pool(), move |conn| -> Result<Comment, LemmyError> {
|
||||||
let apub_id = generate_apub_endpoint(
|
let apub_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Comment,
|
EndpointType::Comment,
|
||||||
&inserted_comment_id.to_string(),
|
&inserted_comment_id.to_string(),
|
||||||
&protocol_and_hostname,
|
&protocol_and_hostname,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::PerformCrud;
|
use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_api_common::{blocking, comment::*, get_local_user_view_from_jwt_opt};
|
use lemmy_api_common::{blocking, comment::*, get_local_user_view_from_jwt_opt};
|
||||||
use lemmy_apub::{build_actor_id_from_shortname, EndpointType};
|
use lemmy_apub::get_actor_id_from_name;
|
||||||
|
use lemmy_apub_lib::webfinger::WebfingerType;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
from_opt_str_to_opt_enum,
|
from_opt_str_to_opt_enum,
|
||||||
traits::DeleteableOrRemoveable,
|
traits::DeleteableOrRemoveable,
|
||||||
|
@ -34,11 +35,13 @@ impl PerformCrud for GetComments {
|
||||||
let listing_type: Option<ListingType> = from_opt_str_to_opt_enum(&data.type_);
|
let listing_type: Option<ListingType> = from_opt_str_to_opt_enum(&data.type_);
|
||||||
|
|
||||||
let community_id = data.community_id;
|
let community_id = data.community_id;
|
||||||
let community_actor_id = data
|
let community_actor_id = if let Some(name) = &data.community_name {
|
||||||
.community_name
|
get_actor_id_from_name(WebfingerType::Group, name, context)
|
||||||
.as_ref()
|
.await
|
||||||
.map(|t| build_actor_id_from_shortname(EndpointType::Community, t, &context.settings()).ok())
|
.ok()
|
||||||
.unwrap_or(None);
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
let saved_only = data.saved_only;
|
let saved_only = data.saved_only;
|
||||||
let page = data.page;
|
let page = data.page;
|
||||||
let limit = data.limit;
|
let limit = data.limit;
|
||||||
|
|
|
@ -8,9 +8,9 @@ use lemmy_api_common::{
|
||||||
};
|
};
|
||||||
use lemmy_apub::{
|
use lemmy_apub::{
|
||||||
fetcher::object_id::ObjectId,
|
fetcher::object_id::ObjectId,
|
||||||
generate_apub_endpoint,
|
|
||||||
generate_followers_url,
|
generate_followers_url,
|
||||||
generate_inbox_url,
|
generate_inbox_url,
|
||||||
|
generate_local_apub_endpoint,
|
||||||
generate_shared_inbox_url,
|
generate_shared_inbox_url,
|
||||||
objects::community::ApubCommunity,
|
objects::community::ApubCommunity,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
|
@ -67,7 +67,7 @@ impl PerformCrud for CreateCommunity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double check for duplicate community actor_ids
|
// Double check for duplicate community actor_ids
|
||||||
let community_actor_id = generate_apub_endpoint(
|
let community_actor_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Community,
|
EndpointType::Community,
|
||||||
&data.name,
|
&data.name,
|
||||||
&context.settings().get_protocol_and_hostname(),
|
&context.settings().get_protocol_and_hostname(),
|
||||||
|
|
|
@ -2,11 +2,11 @@ use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_api_common::{blocking, community::*, get_local_user_view_from_jwt_opt};
|
use lemmy_api_common::{blocking, community::*, get_local_user_view_from_jwt_opt};
|
||||||
use lemmy_apub::{
|
use lemmy_apub::{
|
||||||
build_actor_id_from_shortname,
|
|
||||||
fetcher::object_id::ObjectId,
|
fetcher::object_id::ObjectId,
|
||||||
|
get_actor_id_from_name,
|
||||||
objects::community::ApubCommunity,
|
objects::community::ApubCommunity,
|
||||||
EndpointType,
|
|
||||||
};
|
};
|
||||||
|
use lemmy_apub_lib::webfinger::WebfingerType;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
from_opt_str_to_opt_enum,
|
from_opt_str_to_opt_enum,
|
||||||
traits::DeleteableOrRemoveable,
|
traits::DeleteableOrRemoveable,
|
||||||
|
@ -39,7 +39,7 @@ impl PerformCrud for GetCommunity {
|
||||||
None => {
|
None => {
|
||||||
let name = data.name.to_owned().unwrap_or_else(|| "main".to_string());
|
let name = data.name.to_owned().unwrap_or_else(|| "main".to_string());
|
||||||
let community_actor_id =
|
let community_actor_id =
|
||||||
build_actor_id_from_shortname(EndpointType::Community, &name, &context.settings())?;
|
get_actor_id_from_name(WebfingerType::Group, &name, context).await?;
|
||||||
|
|
||||||
ObjectId::<ApubCommunity>::new(community_actor_id)
|
ObjectId::<ApubCommunity>::new(community_actor_id)
|
||||||
.dereference(context, &mut 0)
|
.dereference(context, &mut 0)
|
||||||
|
|
|
@ -16,7 +16,7 @@ use lemmy_apub::{
|
||||||
CreateOrUpdateType,
|
CreateOrUpdateType,
|
||||||
},
|
},
|
||||||
fetcher::post_or_comment::PostOrComment,
|
fetcher::post_or_comment::PostOrComment,
|
||||||
generate_apub_endpoint,
|
generate_local_apub_endpoint,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -98,7 +98,7 @@ impl PerformCrud for CreatePost {
|
||||||
let inserted_post_id = inserted_post.id;
|
let inserted_post_id = inserted_post.id;
|
||||||
let protocol_and_hostname = context.settings().get_protocol_and_hostname();
|
let protocol_and_hostname = context.settings().get_protocol_and_hostname();
|
||||||
let updated_post = blocking(context.pool(), move |conn| -> Result<Post, LemmyError> {
|
let updated_post = blocking(context.pool(), move |conn| -> Result<Post, LemmyError> {
|
||||||
let apub_id = generate_apub_endpoint(
|
let apub_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Post,
|
EndpointType::Post,
|
||||||
&inserted_post_id.to_string(),
|
&inserted_post_id.to_string(),
|
||||||
&protocol_and_hostname,
|
&protocol_and_hostname,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::PerformCrud;
|
use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, mark_post_as_read, post::*};
|
use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, mark_post_as_read, post::*};
|
||||||
use lemmy_apub::{build_actor_id_from_shortname, EndpointType};
|
use lemmy_apub::get_actor_id_from_name;
|
||||||
|
use lemmy_apub_lib::webfinger::WebfingerType;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
from_opt_str_to_opt_enum,
|
from_opt_str_to_opt_enum,
|
||||||
traits::DeleteableOrRemoveable,
|
traits::DeleteableOrRemoveable,
|
||||||
|
@ -136,11 +137,13 @@ impl PerformCrud for GetPosts {
|
||||||
let page = data.page;
|
let page = data.page;
|
||||||
let limit = data.limit;
|
let limit = data.limit;
|
||||||
let community_id = data.community_id;
|
let community_id = data.community_id;
|
||||||
let community_actor_id = data
|
let community_actor_id = if let Some(name) = &data.community_name {
|
||||||
.community_name
|
get_actor_id_from_name(WebfingerType::Group, name, context)
|
||||||
.as_ref()
|
.await
|
||||||
.map(|t| build_actor_id_from_shortname(EndpointType::Community, t, &context.settings()).ok())
|
.ok()
|
||||||
.unwrap_or(None);
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
let saved_only = data.saved_only;
|
let saved_only = data.saved_only;
|
||||||
|
|
||||||
let mut posts = blocking(context.pool(), move |conn| {
|
let mut posts = blocking(context.pool(), move |conn| {
|
||||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_apub::{
|
||||||
private_message::create_or_update::CreateOrUpdatePrivateMessage,
|
private_message::create_or_update::CreateOrUpdatePrivateMessage,
|
||||||
CreateOrUpdateType,
|
CreateOrUpdateType,
|
||||||
},
|
},
|
||||||
generate_apub_endpoint,
|
generate_local_apub_endpoint,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -67,7 +67,7 @@ impl PerformCrud for CreatePrivateMessage {
|
||||||
let updated_private_message = blocking(
|
let updated_private_message = blocking(
|
||||||
context.pool(),
|
context.pool(),
|
||||||
move |conn| -> Result<PrivateMessage, LemmyError> {
|
move |conn| -> Result<PrivateMessage, LemmyError> {
|
||||||
let apub_id = generate_apub_endpoint(
|
let apub_id = generate_local_apub_endpoint(
|
||||||
EndpointType::PrivateMessage,
|
EndpointType::PrivateMessage,
|
||||||
&inserted_private_message_id.to_string(),
|
&inserted_private_message_id.to_string(),
|
||||||
&protocol_and_hostname,
|
&protocol_and_hostname,
|
||||||
|
|
|
@ -2,9 +2,9 @@ use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_api_common::{blocking, honeypot_check, password_length_check, person::*};
|
use lemmy_api_common::{blocking, honeypot_check, password_length_check, person::*};
|
||||||
use lemmy_apub::{
|
use lemmy_apub::{
|
||||||
generate_apub_endpoint,
|
|
||||||
generate_followers_url,
|
generate_followers_url,
|
||||||
generate_inbox_url,
|
generate_inbox_url,
|
||||||
|
generate_local_apub_endpoint,
|
||||||
generate_shared_inbox_url,
|
generate_shared_inbox_url,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
};
|
};
|
||||||
|
@ -96,7 +96,7 @@ impl PerformCrud for Register {
|
||||||
if !is_valid_actor_name(&data.username, context.settings().actor_name_max_length) {
|
if !is_valid_actor_name(&data.username, context.settings().actor_name_max_length) {
|
||||||
return Err(ApiError::err_plain("invalid_username").into());
|
return Err(ApiError::err_plain("invalid_username").into());
|
||||||
}
|
}
|
||||||
let actor_id = generate_apub_endpoint(
|
let actor_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Person,
|
EndpointType::Person,
|
||||||
&data.username,
|
&data.username,
|
||||||
&context.settings().get_protocol_and_hostname(),
|
&context.settings().get_protocol_and_hostname(),
|
||||||
|
@ -179,7 +179,7 @@ impl PerformCrud for Register {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
let default_community_name = "main";
|
let default_community_name = "main";
|
||||||
let actor_id = generate_apub_endpoint(
|
let actor_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Community,
|
EndpointType::Community,
|
||||||
default_community_name,
|
default_community_name,
|
||||||
&protocol_and_hostname,
|
&protocol_and_hostname,
|
||||||
|
|
|
@ -2,11 +2,11 @@ use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, person::*};
|
use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, person::*};
|
||||||
use lemmy_apub::{
|
use lemmy_apub::{
|
||||||
build_actor_id_from_shortname,
|
|
||||||
fetcher::object_id::ObjectId,
|
fetcher::object_id::ObjectId,
|
||||||
|
get_actor_id_from_name,
|
||||||
objects::person::ApubPerson,
|
objects::person::ApubPerson,
|
||||||
EndpointType,
|
|
||||||
};
|
};
|
||||||
|
use lemmy_apub_lib::webfinger::WebfingerType;
|
||||||
use lemmy_db_schema::{from_opt_str_to_opt_enum, SortType};
|
use lemmy_db_schema::{from_opt_str_to_opt_enum, SortType};
|
||||||
use lemmy_db_views::{comment_view::CommentQueryBuilder, post_view::PostQueryBuilder};
|
use lemmy_db_views::{comment_view::CommentQueryBuilder, post_view::PostQueryBuilder};
|
||||||
use lemmy_db_views_actor::{
|
use lemmy_db_views_actor::{
|
||||||
|
@ -46,8 +46,7 @@ impl PerformCrud for GetPersonDetails {
|
||||||
.username
|
.username
|
||||||
.to_owned()
|
.to_owned()
|
||||||
.unwrap_or_else(|| "admin".to_string());
|
.unwrap_or_else(|| "admin".to_string());
|
||||||
let actor_id =
|
let actor_id = get_actor_id_from_name(WebfingerType::Person, &name, context).await?;
|
||||||
build_actor_id_from_shortname(EndpointType::Person, &name, &context.settings())?;
|
|
||||||
|
|
||||||
let person = ObjectId::<ApubPerson>::new(actor_id)
|
let person = ObjectId::<ApubPerson>::new(actor_id)
|
||||||
.dereference(context, &mut 0)
|
.dereference(context, &mut 0)
|
||||||
|
|
|
@ -12,7 +12,11 @@ extern crate lazy_static;
|
||||||
use crate::fetcher::post_or_comment::PostOrComment;
|
use crate::fetcher::post_or_comment::PostOrComment;
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{activity_queue::send_activity, traits::ActorType};
|
use lemmy_apub_lib::{
|
||||||
|
activity_queue::send_activity,
|
||||||
|
traits::ActorType,
|
||||||
|
webfinger::{webfinger_resolve_actor, WebfingerType},
|
||||||
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
newtypes::{CommunityId, DbUrl},
|
newtypes::{CommunityId, DbUrl},
|
||||||
source::{activity::Activity, person::Person},
|
source::{activity::Activity, person::Person},
|
||||||
|
@ -111,7 +115,7 @@ pub enum EndpointType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates an apub endpoint for a given domain, IE xyz.tld
|
/// Generates an apub endpoint for a given domain, IE xyz.tld
|
||||||
fn generate_apub_endpoint_for_domain(
|
pub fn generate_local_apub_endpoint(
|
||||||
endpoint_type: EndpointType,
|
endpoint_type: EndpointType,
|
||||||
name: &str,
|
name: &str,
|
||||||
domain: &str,
|
domain: &str,
|
||||||
|
@ -127,15 +131,6 @@ fn generate_apub_endpoint_for_domain(
|
||||||
Ok(Url::parse(&format!("{}/{}/{}", domain, point, name))?.into())
|
Ok(Url::parse(&format!("{}/{}/{}", domain, point, name))?.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates the ActivityPub ID for a given object type and ID.
|
|
||||||
pub fn generate_apub_endpoint(
|
|
||||||
endpoint_type: EndpointType,
|
|
||||||
name: &str,
|
|
||||||
protocol_and_hostname: &str,
|
|
||||||
) -> Result<DbUrl, ParseError> {
|
|
||||||
generate_apub_endpoint_for_domain(endpoint_type, name, protocol_and_hostname)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn generate_followers_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
|
pub fn generate_followers_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
|
||||||
Ok(Url::parse(&format!("{}/followers", actor_id))?.into())
|
Ok(Url::parse(&format!("{}/followers", actor_id))?.into())
|
||||||
}
|
}
|
||||||
|
@ -169,23 +164,31 @@ fn generate_moderators_url(community_id: &DbUrl) -> Result<DbUrl, LemmyError> {
|
||||||
|
|
||||||
/// Takes in a shortname of the type dessalines@xyz.tld or dessalines (assumed to be local), and outputs the actor id.
|
/// Takes in a shortname of the type dessalines@xyz.tld or dessalines (assumed to be local), and outputs the actor id.
|
||||||
/// Used in the API for communities and users.
|
/// Used in the API for communities and users.
|
||||||
pub fn build_actor_id_from_shortname(
|
pub async fn get_actor_id_from_name(
|
||||||
endpoint_type: EndpointType,
|
webfinger_type: WebfingerType,
|
||||||
short_name: &str,
|
short_name: &str,
|
||||||
settings: &Settings,
|
context: &LemmyContext,
|
||||||
) -> Result<DbUrl, ParseError> {
|
) -> Result<DbUrl, LemmyError> {
|
||||||
let split = short_name.split('@').collect::<Vec<&str>>();
|
let split = short_name.split('@').collect::<Vec<&str>>();
|
||||||
|
|
||||||
let name = split[0];
|
let name = split[0];
|
||||||
|
|
||||||
// If there's no @, its local
|
// If there's no @, its local
|
||||||
let domain = if split.len() == 1 {
|
if split.len() == 1 {
|
||||||
settings.get_protocol_and_hostname()
|
let domain = context.settings().get_protocol_and_hostname();
|
||||||
|
let endpoint_type = match webfinger_type {
|
||||||
|
WebfingerType::Person => EndpointType::Person,
|
||||||
|
WebfingerType::Group => EndpointType::Community,
|
||||||
|
};
|
||||||
|
Ok(generate_local_apub_endpoint(endpoint_type, name, &domain)?)
|
||||||
} else {
|
} else {
|
||||||
format!("{}://{}", settings.get_protocol_string(), split[1])
|
let protocol = context.settings().get_protocol_string();
|
||||||
};
|
Ok(
|
||||||
|
webfinger_resolve_actor(name, split[1], webfinger_type, context.client(), protocol)
|
||||||
generate_apub_endpoint_for_domain(endpoint_type, name, &domain)
|
.await?
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Store a sent or received activity in the database, for logging purposes. These records are not
|
/// Store a sent or received activity in the database, for logging purposes. These records are not
|
||||||
|
|
|
@ -4,9 +4,9 @@ use diesel::{
|
||||||
*,
|
*,
|
||||||
};
|
};
|
||||||
use lemmy_apub::{
|
use lemmy_apub::{
|
||||||
generate_apub_endpoint,
|
|
||||||
generate_followers_url,
|
generate_followers_url,
|
||||||
generate_inbox_url,
|
generate_inbox_url,
|
||||||
|
generate_local_apub_endpoint,
|
||||||
generate_shared_inbox_url,
|
generate_shared_inbox_url,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ fn user_updates_2020_04_02(
|
||||||
|
|
||||||
let form = PersonForm {
|
let form = PersonForm {
|
||||||
name: cperson.name.to_owned(),
|
name: cperson.name.to_owned(),
|
||||||
actor_id: Some(generate_apub_endpoint(
|
actor_id: Some(generate_local_apub_endpoint(
|
||||||
EndpointType::Person,
|
EndpointType::Person,
|
||||||
&cperson.name,
|
&cperson.name,
|
||||||
protocol_and_hostname,
|
protocol_and_hostname,
|
||||||
|
@ -93,7 +93,7 @@ fn community_updates_2020_04_02(
|
||||||
|
|
||||||
for ccommunity in &incorrect_communities {
|
for ccommunity in &incorrect_communities {
|
||||||
let keypair = generate_actor_keypair()?;
|
let keypair = generate_actor_keypair()?;
|
||||||
let community_actor_id = generate_apub_endpoint(
|
let community_actor_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Community,
|
EndpointType::Community,
|
||||||
&ccommunity.name,
|
&ccommunity.name,
|
||||||
protocol_and_hostname,
|
protocol_and_hostname,
|
||||||
|
@ -143,7 +143,7 @@ fn post_updates_2020_04_03(
|
||||||
.load::<Post>(conn)?;
|
.load::<Post>(conn)?;
|
||||||
|
|
||||||
for cpost in &incorrect_posts {
|
for cpost in &incorrect_posts {
|
||||||
let apub_id = generate_apub_endpoint(
|
let apub_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Post,
|
EndpointType::Post,
|
||||||
&cpost.id.to_string(),
|
&cpost.id.to_string(),
|
||||||
protocol_and_hostname,
|
protocol_and_hostname,
|
||||||
|
@ -171,7 +171,7 @@ fn comment_updates_2020_04_03(
|
||||||
.load::<Comment>(conn)?;
|
.load::<Comment>(conn)?;
|
||||||
|
|
||||||
for ccomment in &incorrect_comments {
|
for ccomment in &incorrect_comments {
|
||||||
let apub_id = generate_apub_endpoint(
|
let apub_id = generate_local_apub_endpoint(
|
||||||
EndpointType::Comment,
|
EndpointType::Comment,
|
||||||
&ccomment.id.to_string(),
|
&ccomment.id.to_string(),
|
||||||
protocol_and_hostname,
|
protocol_and_hostname,
|
||||||
|
@ -199,7 +199,7 @@ fn private_message_updates_2020_05_05(
|
||||||
.load::<PrivateMessage>(conn)?;
|
.load::<PrivateMessage>(conn)?;
|
||||||
|
|
||||||
for cpm in &incorrect_pms {
|
for cpm in &incorrect_pms {
|
||||||
let apub_id = generate_apub_endpoint(
|
let apub_id = generate_local_apub_endpoint(
|
||||||
EndpointType::PrivateMessage,
|
EndpointType::PrivateMessage,
|
||||||
&cpm.id.to_string(),
|
&cpm.id.to_string(),
|
||||||
protocol_and_hostname,
|
protocol_and_hostname,
|
||||||
|
|
Loading…
Reference in a new issue