diff --git a/bookwyrm/tests/views/inbox/test_inbox_update.py b/bookwyrm/tests/views/inbox/test_inbox_update.py index 2345495d..0efeac0c 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_update.py +++ b/bookwyrm/tests/views/inbox/test_inbox_update.py @@ -180,6 +180,7 @@ class InboxUpdate(TestCase): datafile = pathlib.Path(__file__).parent.joinpath("../../data/ap_note.json") status_data = json.loads(datafile.read_bytes()) status_data["id"] = status.remote_id + status_data["updated"] = "2021-12-13T05:09:29Z" activity = self.update_json activity["object"] = status_data @@ -189,4 +190,6 @@ class InboxUpdate(TestCase): status.refresh_from_db() self.assertEqual(status.content, "test content in note") - self.assertTrue(status.edited) + self.assertEqual(status.edited_date.year, 2021) + self.assertEqual(status.edited_date.month, 12) + self.assertEqual(status.edited_date.day, 13) diff --git a/bookwyrm/tests/views/test_status.py b/bookwyrm/tests/views/test_status.py index 6764da93..2da28ac6 100644 --- a/bookwyrm/tests/views/test_status.py +++ b/bookwyrm/tests/views/test_status.py @@ -381,6 +381,7 @@ http://www.fish.com/""" def test_create_status_edit_success(self, mock, *_): """update an existing status""" status = models.Status.objects.create(content="status", user=self.local_user) + self.assertIsNone(status.edited_date) view = views.CreateStatus.as_view() form = forms.CommentForm( { @@ -400,7 +401,7 @@ http://www.fish.com/""" status.refresh_from_db() self.assertEqual(status.content, "
hi
") - self.assertTrue(status.edited) + self.assertIsNotNone(status.edited_date) def test_create_status_edit_permission_denied(self, *_): """update an existing status""" diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index d2e85279..42806448 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -8,6 +8,7 @@ from django.core.exceptions import ValidationError from django.http import HttpResponse, HttpResponseBadRequest, Http404 from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse +from django.utils import timezone from django.utils.decorators import method_decorator from django.views import View from django.views.decorators.http import require_POST @@ -62,7 +63,7 @@ class CreateStatus(View): models.Status.objects.select_subclasses(), id=existing_status_id ) existing_status.raise_not_editable(request.user) - existing_status.edited = True + existing_status.edited_date = timezone.now() status_type = status_type[0].upper() + status_type[1:]