Skip to content

Commit

Permalink
Keep author field in comments when author is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
psrok1 committed Feb 19, 2024
1 parent c7608e2 commit df21b3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mwdb/schema/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ class CommentRequestSchema(CommentSchemaBase):

class CommentItemResponseSchema(CommentSchemaBase):
id = fields.Int(required=True, allow_none=False)
author = fields.Str(required=True, allow_none=False, attribute="author_login")
author = fields.Str(required=True, default=None, attribute="author_login")
timestamp = UTCDateTime(required=True, allow_none=False)
2 changes: 1 addition & 1 deletion tests/backend/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,4 @@ def test_user_delete(admin_session):
comments = admin_session.get_comments(sample.dhash)
assert len(comments) == 1
assert comments[0]["comment"] == "random comment"
assert comments[0].get("author") is None
assert comments[0]["author"] is None

0 comments on commit df21b3b

Please sign in to comment.