diff --git a/blueprints/admin.py b/blueprints/admin.py index 60dbc6c..ec9642d 100644 --- a/blueprints/admin.py +++ b/blueprints/admin.py @@ -191,11 +191,32 @@ def admin_tasks() -> _Response: def admin_lookup() -> _Response: data = None meta = None + follower = None + following = None if request.args.get("url"): data = lookup(request.args.get("url")) # type: ignore if data: if not data.has_type(ap.ACTOR_TYPES): meta = _meta(data) + else: + follower = find_one_activity( + { + "box": "inbox", + "type": ap.ActivityType.FOLLOW.value, + "meta.actor_id": data.id, + "meta.undo": False, + } + ) + following = find_one_activity( + { + **by_type(ap.ActivityType.FOLLOW), + **by_object_id(data.id), + **not_undo(), + **in_outbox(), + **follow_request_accepted(), + } + ) + if data.has_type(ap.ActivityType.QUESTION): p.push(data.id, "/task/fetch_remote_question") @@ -203,7 +224,12 @@ def admin_lookup() -> _Response: app.logger.debug(data.to_dict()) return htmlify( render_template( - "lookup.html", data=data, meta=meta, url=request.args.get("url") + "lookup.html", + data=data, + meta=meta, + follower=follower, + following=following, + url=request.args.get("url"), ) ) diff --git a/templates/lookup.html b/templates/lookup.html index 6790c10..fa740cc 100644 --- a/templates/lookup.html +++ b/templates/lookup.html @@ -17,6 +17,20 @@