mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 19:31:33 +00:00
parent
16f98261f8
commit
2544341e47
1 changed files with 11 additions and 8 deletions
|
@ -43,21 +43,24 @@ async fn get_webfinger_response(
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let name_ = name.clone();
|
let name_ = name.clone();
|
||||||
let community_id: Option<Url> = blocking(context.pool(), move |conn| {
|
|
||||||
Community::read_from_name(conn, &name_)
|
|
||||||
})
|
|
||||||
.await?
|
|
||||||
.ok()
|
|
||||||
.map(|c| c.actor_id.into());
|
|
||||||
let user_id: Option<Url> = blocking(context.pool(), move |conn| {
|
let user_id: Option<Url> = blocking(context.pool(), move |conn| {
|
||||||
Person::find_by_name(conn, &name)
|
Person::find_by_name(conn, &name_)
|
||||||
})
|
})
|
||||||
.await?
|
.await?
|
||||||
.ok()
|
.ok()
|
||||||
.map(|c| c.actor_id.into());
|
.map(|c| c.actor_id.into());
|
||||||
|
let community_id: Option<Url> = blocking(context.pool(), move |conn| {
|
||||||
|
Community::read_from_name(conn, &name)
|
||||||
|
})
|
||||||
|
.await?
|
||||||
|
.ok()
|
||||||
|
.map(|c| c.actor_id.into());
|
||||||
|
|
||||||
|
// Mastodon seems to prioritize the last webfinger item in case of duplicates. Put
|
||||||
|
// community last so that it gets prioritized. For Lemmy the order doesnt matter.
|
||||||
let links = vec![
|
let links = vec![
|
||||||
webfinger_link_for_actor(community_id),
|
|
||||||
webfinger_link_for_actor(user_id),
|
webfinger_link_for_actor(user_id),
|
||||||
|
webfinger_link_for_actor(community_id),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
|
|
Loading…
Reference in a new issue