diff --git a/api/funkwhale_api/federation/models.py b/api/funkwhale_api/federation/models.py index 4b7730402..5e81143cb 100644 --- a/api/funkwhale_api/federation/models.py +++ b/api/funkwhale_api/federation/models.py @@ -66,15 +66,6 @@ class DomainQuerySet(models.QuerySet): def external(self): return self.exclude(pk=settings.FEDERATION_HOSTNAME) - def with_last_activity_date(self): - activities = Activity.objects.filter( - actor__domain=models.OuterRef("pk") - ).order_by("-creation_date") - - return self.annotate( - last_activity_date=models.Subquery(activities.values("creation_date")[:1]) - ) - def with_actors_count(self): return self.annotate(actors_count=models.Count("actors", distinct=True)) @@ -111,7 +102,6 @@ class Domain(models.Model): actors=models.Count("actors", distinct=True), outbox_activities=models.Count("actors__outbox_activities", distinct=True), libraries=models.Count("actors__libraries", distinct=True), - uploads=models.Count("actors__libraries__uploads", distinct=True), received_library_follows=models.Count( "actors__libraries__received_follows", distinct=True ), @@ -130,6 +120,7 @@ class Domain(models.Model): ).count() uploads = music_models.Upload.objects.filter(library__actor__domain_id=self.pk) + data["uploads"] = uploads.count() data["media_total_size"] = uploads.aggregate(v=models.Sum("size"))["v"] or 0 data["media_downloaded_size"] = ( uploads.with_file().aggregate(v=models.Sum("size"))["v"] or 0 diff --git a/api/funkwhale_api/manage/serializers.py b/api/funkwhale_api/manage/serializers.py index a401381e6..710d3d62b 100644 --- a/api/funkwhale_api/manage/serializers.py +++ b/api/funkwhale_api/manage/serializers.py @@ -173,7 +173,6 @@ class ManageInvitationActionSerializer(common_serializers.ActionSerializer): class ManageDomainSerializer(serializers.ModelSerializer): actors_count = serializers.SerializerMethodField() - last_activity_date = serializers.SerializerMethodField() outbox_activities_count = serializers.SerializerMethodField() class Meta: @@ -182,7 +181,6 @@ class ManageDomainSerializer(serializers.ModelSerializer): "name", "creation_date", "actors_count", - "last_activity_date", "outbox_activities_count", "nodeinfo", "nodeinfo_fetch_date", @@ -191,8 +189,5 @@ class ManageDomainSerializer(serializers.ModelSerializer): def get_actors_count(self, o): return getattr(o, "actors_count", 0) - def get_last_activity_date(self, o): - return getattr(o, "last_activity_date", None) - def get_outbox_activities_count(self, o): return getattr(o, "outbox_activities_count", 0) diff --git a/api/funkwhale_api/manage/views.py b/api/funkwhale_api/manage/views.py index 98ba220e5..c3d87be52 100644 --- a/api/funkwhale_api/manage/views.py +++ b/api/funkwhale_api/manage/views.py @@ -102,7 +102,6 @@ class ManageDomainViewSet( lookup_value_regex = r"[a-zA-Z0-9\-\.]+" queryset = ( federation_models.Domain.objects.external() - .with_last_activity_date() .with_actors_count() .with_outbox_activities_count() .order_by("name") @@ -114,7 +113,7 @@ class ManageDomainViewSet( ordering_fields = [ "name", "creation_date", - "last_activity_date", + "nodeinfo_fetch_date", "actors_count", "outbox_activities_count", ] diff --git a/api/tests/manage/test_serializers.py b/api/tests/manage/test_serializers.py index d3b96ec22..8a9f2ac8e 100644 --- a/api/tests/manage/test_serializers.py +++ b/api/tests/manage/test_serializers.py @@ -40,11 +40,9 @@ def test_manage_domain_serializer(factories, now): domain = factories["federation.Domain"]() setattr(domain, "actors_count", 42) setattr(domain, "outbox_activities_count", 23) - setattr(domain, "last_activity_date", now) expected = { "name": domain.name, "creation_date": domain.creation_date.isoformat().split("+")[0] + "Z", - "last_activity_date": now, "actors_count": 42, "outbox_activities_count": 23, "nodeinfo": {}, diff --git a/front/src/components/manage/moderation/DomainsTable.vue b/front/src/components/manage/moderation/DomainsTable.vue index cddff5fa4..fd6a2bd46 100644 --- a/front/src/components/manage/moderation/DomainsTable.vue +++ b/front/src/components/manage/moderation/DomainsTable.vue @@ -38,7 +38,6 @@