microblog.pub/app/templates/notifications.html

124 lines
6.8 KiB
HTML
Raw Normal View History

2022-06-22 18:11:22 +00:00
{%- import "utils.html" as utils with context -%}
{% extends "layout.html" %}
2022-07-15 18:01:55 +00:00
{% block head %}
<title>{{ local_actor.display_name }} - Notifications</title>
{% endblock %}
2022-08-26 06:18:51 +00:00
{% macro notif_actor_action(notif, text, with_icon=False) %}
2022-07-31 13:00:06 +00:00
<div class="actor-action">
2022-08-26 06:18:51 +00:00
<a href="{{ url_for("admin_profile") }}?actor_id={{ notif.actor.ap_id }}">
{% if with_icon %}{{ utils.display_tiny_actor_icon(notif.actor) }}{% endif %} {{ notif.actor.display_name | clean_html(notif.actor) | safe }}</a> {{ text }}
2022-07-31 13:00:06 +00:00
<span title="{{ notif.created_at.isoformat() }}">{{ notif.created_at | timeago }}</span>
</div>
{% endmacro %}
2022-06-22 18:11:22 +00:00
{% block content %}
2022-07-09 06:15:33 +00:00
<div class="box">
2022-06-22 18:11:22 +00:00
<h2>Notifications</h2>
2022-07-09 06:15:33 +00:00
</div>
2022-06-22 18:11:22 +00:00
<div id="notifications">
{%- for notif in notifications %}
<div>
{%- if notif.notification_type.value == "new_follower" %}
2022-07-31 13:00:06 +00:00
{{ notif_actor_action(notif, "followed you") }}
2022-06-22 18:11:22 +00:00
{{ utils.display_actor(notif.actor, actors_metadata) }}
{%- elif notif.notification_type.value == "pending_incoming_follower" %}
{{ notif_actor_action(notif, "sent a follow request") }}
{{ utils.display_actor(notif.actor, actors_metadata, pending_incoming_follow_notif=notif) }}
{% elif notif.notification_type.value == "rejected_follower" %}
2022-06-22 18:11:22 +00:00
{% elif notif.notification_type.value == "unfollow" %}
2022-07-31 13:00:06 +00:00
{{ notif_actor_action(notif, "unfollowed you") }}
2022-06-22 18:11:22 +00:00
{{ utils.display_actor(notif.actor, actors_metadata) }}
{%- elif notif.notification_type.value == "follow_request_accepted" %}
2022-07-31 13:00:06 +00:00
{{ notif_actor_action(notif, "accepted your follow request") }}
{{ utils.display_actor(notif.actor, actors_metadata) }}
{%- elif notif.notification_type.value == "follow_request_rejected" %}
2022-07-31 13:00:06 +00:00
{{ notif_actor_action(notif, "rejected your follow request") }}
{{ utils.display_actor(notif.actor, actors_metadata) }}
2022-10-18 19:39:09 +00:00
{% elif notif.notification_type.value == "blocked" %}
{{ notif_actor_action(notif, "blocked you") }}
{{ utils.display_actor(notif.actor, actors_metadata) }}
{% elif notif.notification_type.value == "unblocked" %}
{{ notif_actor_action(notif, "unblocked you") }}
{{ utils.display_actor(notif.actor, actors_metadata) }}
2022-10-23 14:37:24 +00:00
{% elif notif.notification_type.value == "block" %}
{{ notif_actor_action(notif, "was blocked") }}
{{ utils.display_actor(notif.actor, actors_metadata) }}
{% elif notif.notification_type.value == "unblock" %}
{{ notif_actor_action(notif, "was unblocked") }}
{{ utils.display_actor(notif.actor, actors_metadata) }}
{%- elif notif.notification_type.value == "move" %}
{# for move notif, the actor is the target and the inbox object the Move activity #}
<div class="actor-action">
<a href="{{ url_for("admin_profile") }}?actor_id={{ notif.inbox_object.actor.ap_id }}">
{{ utils.display_tiny_actor_icon(notif.inbox_object.actor) }} {{ notif.inbox_object.actor.display_name | clean_html(notif.inbox_object.actor) | safe }}</a> has moved to
<span title="{{ notif.created_at.isoformat() }}">{{ notif.created_at | timeago }}</span>
</div>
{{ utils.display_actor(notif.actor) }}
2022-06-22 18:11:22 +00:00
{% elif notif.notification_type.value == "like" %}
2022-08-26 06:15:49 +00:00
{{ notif_actor_action(notif, "liked a post", with_icon=True) }}
2022-06-22 18:11:22 +00:00
{{ utils.display_object(notif.outbox_object) }}
{% elif notif.notification_type.value == "undo_like" %}
2022-08-26 06:15:49 +00:00
{{ notif_actor_action(notif, "unliked a post", with_icon=True) }}
2022-06-22 18:11:22 +00:00
{{ utils.display_object(notif.outbox_object) }}
{% elif notif.notification_type.value == "announce" %}
2022-08-26 06:15:49 +00:00
{{ notif_actor_action(notif, "shared a post", with_icon=True) }}
2022-06-22 18:11:22 +00:00
{{ utils.display_object(notif.outbox_object) }}
{% elif notif.notification_type.value == "undo_announce" %}
{{ notif_actor_action(notif, "unshared a post", with_icon=True) }}
{{ utils.display_object(notif.outbox_object) }}
2022-06-26 08:55:53 +00:00
{% elif notif.notification_type.value == "mention" %}
2022-07-31 13:00:06 +00:00
{{ notif_actor_action(notif, "mentioned you") }}
2022-06-26 08:55:53 +00:00
{{ utils.display_object(notif.inbox_object) }}
{% elif notif.notification_type.value == "new_webmention" %}
<div class="actor-action" title="{{ notif.created_at.isoformat() }}">
new webmention from
{% set facepile_item = notif.webmention.as_facepile_item %}
{% if facepile_item %}
<a href="{{ facepile_item.actor_url }}">{{ facepile_item.actor_name }}</a>
{% endif %}
2022-08-29 19:42:54 +00:00
<a class="bold" href="{{ notif.webmention.source }}">{{ notif.webmention.source }}</a>
</div>
{{ utils.display_object(notif.outbox_object) }}
{% elif notif.notification_type.value == "updated_webmention" %}
<div class="actor-action" title="{{ notif.created_at.isoformat() }}">
updated webmention from
{% set facepile_item = notif.webmention.as_facepile_item %}
{% if facepile_item %}
<a href="{{ facepile_item.actor_url }}">{{ facepile_item.actor_name }}</a>
{% endif %}
2022-08-29 19:42:54 +00:00
<a class="bold" href="{{ notif.webmention.source }}">{{ notif.webmention.source }}</a>
</div>
{{ utils.display_object(notif.outbox_object) }}
{% elif notif.notification_type.value == "deleted_webmention" %}
<div class="actor-action" title="{{ notif.created_at.isoformat() }}">
deleted webmention from
{% set facepile_item = notif.webmention.as_facepile_item %}
{% if facepile_item %}
<a href="{{ facepile_item.actor_url }}">{{ facepile_item.actor_name }}</a>
{% endif %}
2022-08-29 19:42:54 +00:00
<a class="bold" href="{{ notif.webmention.source }}">{{ notif.webmention.source }}</a>
</div>
{{ utils.display_object(notif.outbox_object) }}
2022-06-22 18:11:22 +00:00
{% else %}
2022-07-09 06:15:33 +00:00
<div class="actor-action">
Implement {{ notif.notification_type }}
</div>
2022-06-22 18:11:22 +00:00
{%- endif %}
</div>
{%- endfor %}
</div>
2022-08-25 06:45:07 +00:00
{% if next_cursor %}
<div class="box">
<p>
<a href="{{ request.url._path }}?cursor={{ next_cursor }}">
See more{% if more_unread_count %} ({{ more_unread_count }} unread left){% endif %}
2022-08-25 06:45:07 +00:00
</a>
</p>
</div>
{% endif %}
2022-06-22 18:11:22 +00:00
{% endblock %}