|
|
@ -11,10 +11,7 @@ use lemmy_db_schema::{
|
|
|
|
traits::Crud,
|
|
|
|
traits::Crud,
|
|
|
|
utils::DbPool,
|
|
|
|
utils::DbPool,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use lemmy_utils::{
|
|
|
|
use lemmy_utils::{error::LemmyError, utils::mention::scrape_text_for_mentions};
|
|
|
|
error::LemmyError,
|
|
|
|
|
|
|
|
utils::mention::{scrape_text_for_mentions, MentionData},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use serde_json::Value;
|
|
|
|
use serde_json::Value;
|
|
|
|
use url::Url;
|
|
|
|
use url::Url;
|
|
|
@ -67,10 +64,9 @@ pub async fn collect_non_local_mentions(
|
|
|
|
let mentions = scrape_text_for_mentions(&comment.content)
|
|
|
|
let mentions = scrape_text_for_mentions(&comment.content)
|
|
|
|
.into_iter()
|
|
|
|
.into_iter()
|
|
|
|
// Filter only the non-local ones
|
|
|
|
// Filter only the non-local ones
|
|
|
|
.filter(|m| !m.is_local(&context.settings().hostname))
|
|
|
|
.filter(|m| !m.is_local(&context.settings().hostname));
|
|
|
|
.collect::<Vec<MentionData>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for mention in &mentions {
|
|
|
|
for mention in mentions {
|
|
|
|
let identifier = format!("{}@{}", mention.name, mention.domain);
|
|
|
|
let identifier = format!("{}@{}", mention.name, mention.domain);
|
|
|
|
let person = webfinger_resolve_actor::<LemmyContext, ApubPerson>(&identifier, context).await;
|
|
|
|
let person = webfinger_resolve_actor::<LemmyContext, ApubPerson>(&identifier, context).await;
|
|
|
|
if let Ok(person) = person {
|
|
|
|
if let Ok(person) = person {
|
|
|
|