From 9054f05c1d3ccff918bfaa50ff8d25f91df36d71 Mon Sep 17 00:00:00 2001 From: freamon Date: Sun, 13 Oct 2024 12:17:47 +0000 Subject: [PATCH] API: For comments, prefer 'english' over 'no language' or 'undetermined' --- app/api/alpha/utils/reply.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/api/alpha/utils/reply.py b/app/api/alpha/utils/reply.py index e9588975..781058cf 100644 --- a/app/api/alpha/utils/reply.py +++ b/app/api/alpha/utils/reply.py @@ -125,7 +125,9 @@ def post_reply(auth, data): body = data['body'] post_id = data['post_id'] parent_id = data['parent_id'] if 'parent_id' in data else None - language_id = data['language_id'] if 'language_id' in data else 2 + language_id = data['language_id'] if 'language_id' in data else 2 # FIXME: use site language + if language_id < 2: + language_id = 2 # FIXME: use site language input = {'body': body, 'notify_author': True, 'language_id': language_id} post = Post.query.get(post_id) @@ -145,7 +147,9 @@ def put_reply(auth, data): reply_id = data['comment_id'] body = data['body'] if 'body' in data else '' - language_id = data['language_id'] if 'language_id' in data else 2 + language_id = data['language_id'] if 'language_id' in data else 2 # FIXME: use site language + if language_id < 2: + language_id = 2 # FIXME: use site language input = {'body': body, 'notify_author': True, 'language_id': language_id} reply = PostReply.query.get(reply_id)