Fix internal profile page links

This commit is contained in:
Thomas Sileo 2019-09-01 10:48:02 +02:00
parent 96121e57f3
commit c530b24589
3 changed files with 15 additions and 3 deletions

View file

@ -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(

View file

@ -27,7 +27,7 @@
{% if following %}
<form action="/api/undo" class="action-form" method="post">
<input type="hidden" name="redirect" value="{{ actor_redir }}"/>
<input type="hidden" name="id" value="{{ actor.id }}"/>
<input type="hidden" name="id" value="{{ following.id }}"/>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="bar-item">unfollow</button>
</form>

View file

@ -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