rm unused field "is_local_user" in IncomingMessage

status-serialisers
Marnanel Thurman 2020-09-20 23:53:54 +01:00
rodzic c4c5555c8b
commit 482f3132e0
3 zmienionych plików z 23 dodań i 16 usunięć

Wyświetl plik

@ -0,0 +1,17 @@
# Generated by Django 3.0.9 on 2020-09-20 22:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bowler_pub', '0003_incomingmessage'),
]
operations = [
migrations.RemoveField(
model_name='incomingmessage',
name='is_local_user',
),
]

Wyświetl plik

@ -67,8 +67,7 @@ class TestValidation(TestCase):
validate(path=INBOX_PATH,
headers=headers,
body=body,
is_local_user=False)
body=body)
self.assertTrue(
Follow.objects.filter(
@ -109,8 +108,7 @@ class TestValidation(TestCase):
validate(path=INBOX_PATH,
headers=headers,
body=body,
is_local_user=False)
body=body)
self.assertEqual(
len(trilby_models.Follow.objects.filter(
@ -170,8 +168,7 @@ class TestValidation(TestCase):
validate(path=INBOX_PATH,
headers=headers,
body=body,
is_local_user=False)
body=body)
self.assertEqual(
len(trilby_models.Follow.objects.filter(
@ -215,8 +212,7 @@ class TestValidation(TestCase):
validate(path=INBOX_PATH,
headers=headers,
body=body,
is_local_user=False)
body=body)
self.assertEqual(
len(trilby_models.Follow.objects.filter(
@ -268,8 +264,7 @@ class TestValidation(TestCase):
validate(path=INBOX_PATH,
headers=headers,
body=body,
is_local_user=False)
body=body)
self.assertEqual(
len(trilby_models.Follow.objects.filter(

Wyświetl plik

@ -54,7 +54,6 @@ class IncomingMessage(models.Model):
body = models.TextField(default='')
key_id = models.CharField(max_length=255, default='')
digest = models.CharField(max_length=255, default='')
is_local_user = models.BooleanField(default=False)
@property
def actor(self):
@ -88,7 +87,7 @@ class IncomingMessage(models.Model):
self, self._fields)
return self._fields
def validate(path, headers, body, is_local_user):
def validate(path, headers, body):
"""
Validates a message.
@ -100,9 +99,6 @@ def validate(path, headers, body, is_local_user):
path -- the URL path that the message was sent to
headers -- the HTTP headers
body -- the content of the message, as bytes or str
is_local_user -- whether the source is local; this
only exists so we can pass it to create() if
the message is validated.
"""
import kepi.trilby_api.models as trilby_models
@ -130,7 +126,6 @@ def validate(path, headers, body, is_local_user):
signature = headers.get('signature', ''),
digest = headers.get('digest', ''),
body = body,
is_local_user = is_local_user,
)
message.save()