kopia lustrzana https://gitlab.com/marnanel/chapeau
Merge branch 'tombstones' into issue-47
commit
930deeb360
|
@ -7,23 +7,3 @@ PUBLIC_IDS = set([
|
|||
])
|
||||
|
||||
URL_REGEXP = r'https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+'
|
||||
LOCAL_NUMBER_REGEXP = r'/[0-9A-Fa-f]{8}'
|
||||
|
||||
# Decorator
|
||||
def implements_activity_type(f_type):
|
||||
def register(cls):
|
||||
# XXX This will do something again later
|
||||
pass #register_type(f_type, cls)
|
||||
return cls
|
||||
return register
|
||||
|
||||
class TombstoneException(Exception):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__()
|
||||
|
||||
self.activity_form = kwargs.copy()
|
||||
self.activity_form['type'] = 'Tombstone'
|
||||
|
||||
def __str__(self):
|
||||
return str(self.activity_form)
|
||||
|
|
|
@ -144,7 +144,8 @@ class TestTombstone(TestCase):
|
|||
_response_to_dict(response),
|
||||
)
|
||||
|
||||
queen_anne.entomb()
|
||||
queen_anne.gone = True
|
||||
queen_anne.save()
|
||||
|
||||
response = c.get('/users/queen_anne')
|
||||
|
||||
|
@ -154,7 +155,6 @@ class TestTombstone(TestCase):
|
|||
'id': 'https://testserver/users/queen_anne',
|
||||
'type': 'Tombstone',
|
||||
'former_type': 'Person',
|
||||
'name': 'queen_anne',
|
||||
},
|
||||
_response_to_dict(response),
|
||||
)
|
||||
|
|
|
@ -96,9 +96,6 @@ class KepiView(django.views.View):
|
|||
if '@context' not in data:
|
||||
data['@context'] = ATSIGN_CONTEXT
|
||||
|
||||
if 'former_type' in data:
|
||||
data['type'] = 'Tombstone'
|
||||
|
||||
result = JsonResponse(
|
||||
data=data,
|
||||
json_dumps_params={
|
||||
|
@ -197,10 +194,19 @@ class PersonView(KepiView):
|
|||
return result
|
||||
|
||||
def _render_object(self, something):
|
||||
serializer = bowler_serializers.PersonSerializer(
|
||||
something
|
||||
)
|
||||
return super()._render_object(serializer.data)
|
||||
if something.gone:
|
||||
result = {
|
||||
'type': 'Tombstone',
|
||||
'former_type': 'Person',
|
||||
'id': something.url,
|
||||
}
|
||||
else:
|
||||
serializer = bowler_serializers.PersonSerializer(
|
||||
something
|
||||
)
|
||||
result = serializer.data
|
||||
|
||||
return super()._render_object(result)
|
||||
|
||||
class FollowingView(KepiView):
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.9 on 2020-10-29 01:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('trilby_api', '0026_auto_20201019_1524'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='localperson',
|
||||
name='gone',
|
||||
field=models.BooleanField(default=False, help_text='If True, the user has gone away.'),
|
||||
),
|
||||
]
|
|
@ -411,6 +411,11 @@ class LocalPerson(Person):
|
|||
default = False,
|
||||
)
|
||||
|
||||
gone = models.BooleanField(
|
||||
help_text = "If True, the user has gone away.",
|
||||
default = False,
|
||||
)
|
||||
|
||||
featured = models.ForeignKey(
|
||||
'Status',
|
||||
on_delete = models.DO_NOTHING,
|
||||
|
|
|
@ -33,12 +33,6 @@ unfollowed = Signal(
|
|||
'followed',
|
||||
])
|
||||
|
||||
deleted = Signal(
|
||||
providing_args=[
|
||||
'url',
|
||||
'entombed',
|
||||
])
|
||||
|
||||
posted = Signal(
|
||||
providing_args=[
|
||||
])
|
||||
|
|
Ładowanie…
Reference in New Issue