More actor icons

main
Thomas Sileo 2022-08-26 07:43:39 +02:00
parent 365e6cc534
commit 63073279e1
7 changed files with 23 additions and 4 deletions

View File

@ -776,6 +776,8 @@ async def admin_profile(
actor_id: str,
db_session: AsyncSession = Depends(get_db_session),
) -> templates.TemplateResponse:
# TODO: pagination + show featured/pinned
actor = (
await db_session.execute(
select(models.Actor).where(models.Actor.ap_id == actor_id)
@ -809,6 +811,7 @@ async def admin_profile(
joinedload(models.InboxObject.actor),
)
.order_by(models.InboxObject.ap_published_at.desc())
.limit(20)
)
)
.unique()

View File

@ -1721,6 +1721,7 @@ async def _process_transient_object(
raw_object: ap.RawObject,
from_actor: models.Actor,
) -> None:
# TODO: track featured/pinned objects for actors
ap_type = raw_object["type"]
if ap_type in ["Add", "Remove"]:
logger.info(f"Dropping unsupported {ap_type} object")

View File

@ -202,6 +202,13 @@ footer {
margin: 0;
}
}
.tiny-actor-icon {
max-width: 24px;
max-height: 24px;
margin-right: 5px;
position: relative;
top: 5px;
}
.actor-box {
display: flex;
column-gap: 20px;

View File

@ -10,7 +10,9 @@
{% for anybox_object, convo, actors in threads %}
<div class="actor-action">
With {% for actor in actors %}
<a href="">{{ actor.handle }}</a>
<a href="{{ url_for("admin_profile") }}?actor_id={{ actor.ap_id }}">
{{ utils.display_tiny_actor_icon(actor) }} {{ actor.handle }}
</a>
{% endfor %}
</div>
{{ utils.display_object(anybox_object) }}

View File

@ -29,7 +29,7 @@
{% if outbox_object.ap_type in ["Note", "Article", "Video", "Question"] %}
{{ utils.display_object(outbox_object) }}
{% elif outbox_object.ap_type == "Announce" %}
<div class="shared-header"><strong>{{ local_actor.display_name }}</strong> shared</div>
<div class="shared-header"><strong>{{ utils.display_tiny_actor_icon(local_actor) }} {{ local_actor.display_name | clean_html(local_actor) | safe }}</strong> shared</div>
{{ utils.display_object(outbox_object.relates_to_anybox_object) }}
{% endif %}
{% endfor %}

View File

@ -7,7 +7,7 @@
{% macro notif_actor_action(notif, text) %}
<div class="actor-action">
<a href="{{ url_for("admin_profile") }}?actor_id={{ notif.actor.ap_id }}">{{ notif.actor.display_name | clean_html(notif.actor) | safe }}</a> {{ text }}
<a href="{{ url_for("admin_profile") }}?actor_id={{ notif.actor.ap_id }}">{{ utils.display_tiny_actor_icon(notif.actor) }} {{ notif.actor.display_name | clean_html(notif.actor) | safe }}</a> {{ text }}
<span title="{{ notif.created_at.isoformat() }}">{{ notif.created_at | timeago }}</span>
</div>
{% endmacro %}

View File

@ -180,9 +180,15 @@
</nav>
{% endmacro %}
{% macro display_tiny_actor_icon(actor) %}
<img class="tiny-actor-icon" src="{{ actor.resized_icon_url }}" alt="{{ actor.display_name }}'s avatar">
{% endmacro %}
{% macro actor_action(inbox_object, text) %}
<div class="actor-action">
<a href="{{ url_for("admin_profile") }}?actor_id={{ inbox_object.actor.ap_id }}">{{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }}</a> {{ text }}
<a href="{{ url_for("admin_profile") }}?actor_id={{ inbox_object.actor.ap_id }}">
{{ display_tiny_actor_icon(inbox_object.actor) }} {{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }}
</a> {{ text }}
<span title="{{ inbox_object.ap_published_at.isoformat() }}">{{ inbox_object.ap_published_at | timeago }}</span>
</div>