mirror of https://github.com/LemmyNet/lemmy.git
Use person.summary instead of person.content for pleroma compat
parent
ec52c2b71c
commit
c4ade96ef4
|
@ -19,7 +19,7 @@
|
|||
"https://w3id.org/security/v1"
|
||||
],
|
||||
"attributedTo": "https://lemmy.ml/u/nutomic",
|
||||
"content": "While I very much get and respect the general sentiment, I think from the perspective of a Central European non-English person in a country with a significant number of, also non-English speaking Nazis, the current approach of filtering slurs based on an English regex is fatally flawed. You can happily use Lemmy to create a hostile far right community where everyone is easily able to use whatever hurtful slurs they want as long as they are not the few specifically blocked English ones. \n\nOn the other hand you create a situation where people feel the need to question the choice of software of their community because they read about censorship or whatever to be used in Lemmy and might stay away and move to other software even though the would maybe never be affected by the slur-filter as the number is not so large and the overlap with other languages not very big.\n\nSo I would argue that this specific implementation of a slur-filter just doesn't achieve what it aims to achieve and should be fundamentally rethought, maybe as configurable per instance.",
|
||||
"summary": "While I very much get and respect the general sentiment, I think from the perspective of a Central European non-English person in a country with a significant number of, also non-English speaking Nazis, the current approach of filtering slurs based on an English regex is fatally flawed. You can happily use Lemmy to create a hostile far right community where everyone is easily able to use whatever hurtful slurs they want as long as they are not the few specifically blocked English ones. \n\nOn the other hand you create a situation where people feel the need to question the choice of software of their community because they read about censorship or whatever to be used in Lemmy and might stay away and move to other software even though the would maybe never be affected by the slur-filter as the number is not so large and the overlap with other languages not very big.\n\nSo I would argue that this specific implementation of a slur-filter just doesn't achieve what it aims to achieve and should be fundamentally rethought, maybe as configurable per instance.",
|
||||
"id": "https://lemmy.ml/comment/38741",
|
||||
"inReplyTo": "https://lemmy.ml/post/55143",
|
||||
"mediaType": "text/html",
|
||||
|
|
|
@ -13,11 +13,12 @@ use activitystreams::{
|
|||
unparsed::Unparsed,
|
||||
};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use html2md::parse_html;
|
||||
use lemmy_api_common::blocking;
|
||||
use lemmy_apub_lib::{
|
||||
signatures::PublicKey,
|
||||
traits::{ActorType, ApubObject, FromApub, ToApub},
|
||||
values::{MediaTypeHtml, MediaTypeMarkdown},
|
||||
values::MediaTypeMarkdown,
|
||||
verify::verify_domains_match,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
@ -54,8 +55,7 @@ pub struct Person {
|
|||
preferred_username: String,
|
||||
/// displayname (can be changed at any time)
|
||||
name: Option<String>,
|
||||
content: Option<String>,
|
||||
media_type: Option<MediaTypeHtml>,
|
||||
summary: Option<String>,
|
||||
source: Option<Source>,
|
||||
/// user avatar
|
||||
icon: Option<ImageObject>,
|
||||
|
@ -186,8 +186,7 @@ impl ToApub for ApubPerson {
|
|||
id: self.actor_id.to_owned().into_inner(),
|
||||
preferred_username: self.name.clone(),
|
||||
name: self.display_name.clone(),
|
||||
content: self.bio.as_ref().map(|b| markdown_to_html(b)),
|
||||
media_type: self.bio.as_ref().map(|_| MediaTypeHtml::Html),
|
||||
summary: self.bio.as_ref().map(|b| markdown_to_html(b)),
|
||||
source,
|
||||
icon,
|
||||
image,
|
||||
|
@ -224,7 +223,11 @@ impl FromApub for ApubPerson {
|
|||
let actor_id = Some(person.id(expected_domain)?.clone().into());
|
||||
let name = person.preferred_username.clone();
|
||||
let display_name: Option<String> = person.name.clone();
|
||||
let bio = person.source.clone().map(|s| s.content);
|
||||
let bio = if let Some(source) = &person.source {
|
||||
Some(source.content.clone())
|
||||
} else {
|
||||
person.summary.as_ref().map(|s| parse_html(s))
|
||||
};
|
||||
let shared_inbox = person.endpoints.shared_inbox.clone().map(|s| s.into());
|
||||
let bot_account = match person.kind {
|
||||
UserTypes::Person => false,
|
||||
|
@ -315,8 +318,7 @@ mod tests {
|
|||
assert!(person.public_key.is_some());
|
||||
assert!(!person.local);
|
||||
assert_eq!(request_counter, 0);
|
||||
// TODO: pleroma uses summary for user profile, while we use content
|
||||
//assert!(person.bio.is_some());
|
||||
assert_eq!(person.bio.as_ref().unwrap().len(), 873);
|
||||
|
||||
DbPerson::delete(&*context.pool().get().unwrap(), person.id).unwrap();
|
||||
}
|
||||
|
|
|
@ -9,4 +9,4 @@ export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
|
|||
# so to load the config we need to traverse to the repo root
|
||||
export LEMMY_CONFIG_LOCATION=../../config/config.hjson
|
||||
RUST_BACKTRACE=1 \
|
||||
cargo test --workspace --no-fail-fast
|
||||
cargo test --workspace --no-fail-fast test_fetch_pleroma_person
|
||||
|
|
Loading…
Reference in New Issue