forked from alemi/upub
fix(web): also cache user when viewing object
not the cleanest way to do it but eh works
This commit is contained in:
parent
8a36e91fde
commit
26f94cb0de
1 changed files with 7 additions and 0 deletions
|
@ -267,6 +267,13 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView {
|
||||||
None => {
|
None => {
|
||||||
let obj = Http::fetch::<serde_json::Value>(&Uri::api(FetchKind::Object, &oid, true), auth).await.ok()?;
|
let obj = Http::fetch::<serde_json::Value>(&Uri::api(FetchKind::Object, &oid, true), auth).await.ok()?;
|
||||||
let obj = Arc::new(obj);
|
let obj = Arc::new(obj);
|
||||||
|
if let Some(author) = obj.attributed_to().id() {
|
||||||
|
if let Ok(user) = Http::fetch::<serde_json::Value>(
|
||||||
|
&Uri::api(FetchKind::User, &author, true), auth
|
||||||
|
).await {
|
||||||
|
CACHE.put(Uri::full(FetchKind::User, &author), Arc::new(user));
|
||||||
|
}
|
||||||
|
}
|
||||||
CACHE.put(Uri::full(FetchKind::Object, &oid), obj.clone());
|
CACHE.put(Uri::full(FetchKind::Object, &oid), obj.clone());
|
||||||
Some(obj)
|
Some(obj)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue