diff --git a/app/admin.py b/app/admin.py index 118cf4b..55538a8 100644 --- a/app/admin.py +++ b/app/admin.py @@ -682,7 +682,9 @@ async def get_notifications( .where(*where) .options( joinedload(models.Notification.actor), - joinedload(models.Notification.inbox_object), + joinedload(models.Notification.inbox_object).options( + joinedload(models.InboxObject.actor) + ), joinedload(models.Notification.outbox_object).options( joinedload( models.OutboxObject.outbox_object_attachments diff --git a/app/boxes.py b/app/boxes.py index 27e1ae0..bf8e708 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -1371,6 +1371,13 @@ async def _handle_move_activity( else: logger.info(f"Already following target {new_actor_id}") + notif = models.Notification( + notification_type=models.NotificationType.MOVE, + actor_id=new_actor.id, + inbox_object_id=move_activity.id, + ) + db_session.add(notif) + async def _handle_update_activity( db_session: AsyncSession, diff --git a/app/models.py b/app/models.py index 036ef85..30600d1 100644 --- a/app/models.py +++ b/app/models.py @@ -537,6 +537,8 @@ class NotificationType(str, enum.Enum): FOLLOW_REQUEST_ACCEPTED = "follow_request_accepted" FOLLOW_REQUEST_REJECTED = "follow_request_rejected" + MOVE = "move" + LIKE = "like" UNDO_LIKE = "undo_like" diff --git a/app/templates/notifications.html b/app/templates/notifications.html index 97ef851..a5e069f 100644 --- a/app/templates/notifications.html +++ b/app/templates/notifications.html @@ -36,6 +36,14 @@ {%- elif notif.notification_type.value == "follow_request_rejected" %} {{ notif_actor_action(notif, "rejected your follow request") }} {{ 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 #} +