From c530b24589da705c97260427337e82b78ae5fd90 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 1 Sep 2019 10:48:02 +0200 Subject: [PATCH] Fix internal profile page links --- blueprints/admin.py | 12 +++++++++++- templates/stream.html | 2 +- utils/highlight.py | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/blueprints/admin.py b/blueprints/admin.py index c304a46..4cd835c 100644 --- a/blueprints/admin.py +++ b/blueprints/admin.py @@ -26,6 +26,10 @@ from config import PASS from core.activitypub import Box from core.activitypub import post_to_outbox from core.db import find_one_activity +from core.meta import in_outbox +from core.meta import by_actor +from core.meta import not_undo +from core.meta import follow_request_accepted from core.meta import by_object_id from core.meta import by_type from core.shared import MY_PERSON @@ -233,7 +237,13 @@ def admin_profile() -> _Response: } ) following = find_one_activity( - {"type": ap.ActivityType.ACCEPT.value, "meta.actor_id": actor.id} + { + **by_type(ap.ActivityType.FOLLOW), + **by_object_id(actor.id), + **not_undo(), + **in_outbox(), + **follow_request_accepted(), + } ) return htmlify( diff --git a/templates/stream.html b/templates/stream.html index a9736b8..163654c 100644 --- a/templates/stream.html +++ b/templates/stream.html @@ -27,7 +27,7 @@ {% if following %}
- +
diff --git a/utils/highlight.py b/utils/highlight.py index 66352b4..074108d 100644 --- a/utils/highlight.py +++ b/utils/highlight.py @@ -22,7 +22,9 @@ def highlight(html: str) -> str: if not code.parent.name == "pre": continue lexer = guess_lexer(code.text) - tag = BeautifulSoup(phighlight(code.text, lexer, _FORMATTER), "html5lib").body.next + tag = BeautifulSoup( + phighlight(code.text, lexer, _FORMATTER), "html5lib" + ).body.next pre = code.parent pre.replaceWith(tag) out = soup.body