diff --git a/social/templates/events.html b/social/templates/events.html index 48f548db..1e34215f 100644 --- a/social/templates/events.html +++ b/social/templates/events.html @@ -36,7 +36,7 @@ {% if forloop.last %}
diff --git a/social/templates/notification.html b/social/templates/notification.html index 22d5126c..b60ba0f1 100644 --- a/social/templates/notification.html +++ b/social/templates/notification.html @@ -22,9 +22,19 @@ {% include "_header.html" with current="timeline" %}
-
{% trans 'Notification' %}
+
+ {% trans 'Notification' %} + + all | + mention | + follow + +
-
diff --git a/social/views.py b/social/views.py index e90088cb..99e6084f 100644 --- a/social/views.py +++ b/social/views.py @@ -132,7 +132,7 @@ class NotificationEvent: self.post = self.post.in_reply_to_post() if self.post else None self.piece = Piece.get_by_post_id(self.post.id) if self.post else None self.item = getattr(self.piece, "item") if hasattr(self.piece, "item") else None - if self.piece and self.template in ["liked", "boost", "mentioned"]: + if self.piece and self.template in ["liked", "boosted", "mentioned"]: cls = self.piece.__class__.__name__.lower() self.template += "_" + cls @@ -140,7 +140,14 @@ class NotificationEvent: @login_required @require_http_methods(["GET"]) def events(request): - es = Takahe.get_events(request.user.identity.pk) + match request.GET.get("type"): + case "follow": + types = ["followed", "follow_requested"] + case "mention": + types = ["mentioned"] + case _: + types = ["liked", "boosted", "mentioned", "followed", "follow_requested"] + es = Takahe.get_events(request.user.identity.pk, types) last = request.GET.get("last") if last: es = es.filter(created__lt=last) diff --git a/takahe/utils.py b/takahe/utils.py index bc823bdd..46028c95 100644 --- a/takahe/utils.py +++ b/takahe/utils.py @@ -944,7 +944,7 @@ class Takahe: a.seen.add(user) @staticmethod - def get_events(identity_id: int): + def get_events(identity_id: int, types): return ( TimelineEvent.objects.select_related( "subject_post", @@ -962,7 +962,7 @@ class Takahe: "subject_post__emojis", ) .filter(identity=identity_id) - .exclude(type__in=["post", "boost"]) + .filter(type__in=types) .exclude(subject_identity_id=identity_id) .order_by("-created") )