fix(pre-existing): FUser has no nickname field - use first_name (article notify, message sender_name, bug user_name)

This commit is contained in:
async-upgrade
2026-09-06 16:43:20 +08:00
parent d6e39ab976
commit e3d057dd54
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -330,7 +330,7 @@ class ArticleCommentListCreateView(generics.ListCreateAPIView):
parent_comment_id = comment.parent_id
parent_comment_user_id = comment.parent.user_id if comment.parent else None
user_id = request.user.id
user_nickname = request.user.nickname or request.user.username
user_nickname = request.user.first_name or request.user.username
transaction.on_commit(lambda: self._send_notification_messages(
article_id, article_title, article_author_id, comment_id,
@@ -455,7 +455,7 @@ class ArticleLikeToggleView(APIView):
recipient=article.author,
sender=request.user,
msg_type='like',
title=f'{request.user.nickname or request.user.username} 赞了你的文章',
title=f'{request.user.first_name or request.user.username} 赞了你的文章',
content=f'《{article.title}》',
extra_info='',
target_link=f'/article/{pk}',