forked from alemi/upub
fix: webfinger/fetch if checks
This commit is contained in:
parent
8a1afadea0
commit
21cde13f96
1 changed files with 4 additions and 2 deletions
|
@ -20,14 +20,16 @@ pub async fn view(
|
||||||
Query(query): Query<TryFetch>,
|
Query(query): Query<TryFetch>,
|
||||||
) -> crate::Result<JsonLD<serde_json::Value>> {
|
) -> crate::Result<JsonLD<serde_json::Value>> {
|
||||||
let mut uid = ctx.uri("users", id.clone());
|
let mut uid = ctx.uri("users", id.clone());
|
||||||
if auth.is_local() && query.fetch && !ctx.is_local(&uid) {
|
if auth.is_local() {
|
||||||
if id.starts_with('@') {
|
if id.starts_with('@') {
|
||||||
if let Some((user, host)) = id.replacen('@', "", 1).split_once('@') {
|
if let Some((user, host)) = id.replacen('@', "", 1).split_once('@') {
|
||||||
uid = ctx.webfinger(user, host).await?;
|
uid = ctx.webfinger(user, host).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if query.fetch && !ctx.is_local(&uid) {
|
||||||
ctx.fetch_user(&uid).await?;
|
ctx.fetch_user(&uid).await?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (followed_by_me, following_me) = match auth.my_id() {
|
let (followed_by_me, following_me) = match auth.my_id() {
|
||||||
None => (None, None),
|
None => (None, None),
|
||||||
|
|
Loading…
Reference in a new issue