See #170: fetch channel outbox on discovery/detail

This commit is contained in:
Eliot Berriot 2020-03-31 15:54:18 +02:00
parent 0eeead34a4
commit 7435167361
No known key found for this signature in database
GPG key ID: 6B501DFD73514E14
11 changed files with 297 additions and 28 deletions

View file

@ -1,6 +1,7 @@
import uuid
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import JSONField
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
@ -67,6 +68,11 @@ class Channel(models.Model):
default=empty_dict, max_length=50000, encoder=DjangoJSONEncoder, blank=True
)
fetches = GenericRelation(
"federation.Fetch",
content_type_field="object_content_type",
object_id_field="object_id",
)
objects = ChannelQuerySet.as_manager()
@property
@ -74,6 +80,10 @@ class Channel(models.Model):
if not self.is_external_rss:
return self.actor.fid
@property
def is_local(self):
return self.actor.is_local
@property
def is_external_rss(self):
return self.actor.preferred_username.startswith("rssfeed-")