diff options
author | Andrew Godwin | 2022-12-04 20:31:49 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-04 20:31:49 -0700 |
commit | 28ac03c42fb82db5f1dad1f711cffdde0a0cce6c (patch) | |
tree | fec3e964c306671afa7de6d1fdd1e28f00ab4fcf | |
parent | 6291fa0f5c4d30139c23c2e2f2a1daa49852c105 (diff) | |
download | takahe-28ac03c42fb82db5f1dad1f711cffdde0a0cce6c.tar.gz takahe-28ac03c42fb82db5f1dad1f711cffdde0a0cce6c.tar.bz2 takahe-28ac03c42fb82db5f1dad1f711cffdde0a0cce6c.zip |
Fetch user in real-time for searches
Fixes #84
-rw-r--r-- | activities/views/search.py | 8 | ||||
-rw-r--r-- | static/css/style.css | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/activities/views/search.py b/activities/views/search.py index b5e5586..8bdef78 100644 --- a/activities/views/search.py +++ b/activities/views/search.py @@ -1,10 +1,11 @@ from typing import Set +from asgiref.sync import async_to_sync from django import forms from django.views.generic import FormView from activities.models import Hashtag -from users.models import Domain, Identity +from users.models import Domain, Identity, IdentityStates class Search(FormView): @@ -37,7 +38,10 @@ class Search(FormView): identity = Identity.by_username_and_domain( username, domain, fetch=True ) - identity = None + if identity and identity.state == IdentityStates.outdated: + async_to_sync(identity.fetch_actor)() + else: + identity = None if identity: results.add(identity) diff --git a/static/css/style.css b/static/css/style.css index 53b5271..b836f4f 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -782,6 +782,10 @@ table.metadata td.name { margin-left: 32px; } +.post.user { + overflow: hidden; +} + .left-column .post { background: var(--color-bg-box); box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.1); |