add language choices to UI - logged in users only #51

This commit is contained in:
rimu 2024-05-09 19:21:45 +12:00
parent af4dee7ea3
commit 7867b5b346
2 changed files with 6 additions and 6 deletions

View file

@ -517,7 +517,7 @@ def add_discussion_post(actor):
else:
form.communities.data = community.id
form.notify_author.data = True
form.language_id.data = current_user.language_id if current_user.language_id else english_language_id()
form.language_id.data = current_user.language_id if current_user.is_authenticated and current_user.language_id else english_language_id()
if community.posting_warning:
flash(community.posting_warning)
@ -599,7 +599,7 @@ def add_image_post(actor):
else:
form.communities.data = community.id
form.notify_author.data = True
form.language_id.data = current_user.language_id if current_user.language_id else english_language_id()
form.language_id.data = current_user.language_id if current_user.is_authenticated and current_user.language_id else english_language_id()
return render_template('community/add_image_post.html', title=_('Add post to community'), form=form, community=community,
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
@ -679,7 +679,7 @@ def add_link_post(actor):
else:
form.communities.data = community.id
form.notify_author.data = True
form.language_id.data = current_user.language_id if current_user.language_id else english_language_id()
form.language_id.data = current_user.language_id if current_user.is_authenticated and current_user.language_id else english_language_id()
return render_template('community/add_link_post.html', title=_('Add post to community'), form=form, community=community,
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
@ -759,7 +759,7 @@ def add_video_post(actor):
else:
form.communities.data = community.id
form.notify_author.data = True
form.language_id.data = current_user.language_id if current_user.language_id else english_language_id()
form.language_id.data = current_user.language_id if current_user.is_authenticated and current_user.language_id else english_language_id()
return render_template('community/add_video_post.html', title=_('Add post to community'), form=form, community=community,
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,

View file

@ -229,7 +229,7 @@ def show_post(post_id: int):
else:
replies = post_replies(post.id, sort)
form.notify_author.data = True
form.language_id.data = current_user.language_id if current_user.language_id else english_language_id()
form.language_id.data = current_user.language_id if current_user.is_authenticated and current_user.language_id else english_language_id()
og_image = post.image.source_url if post.image_id else None
description = shorten_string(markdown_to_text(post.body), 150) if post.body else None
@ -771,7 +771,7 @@ def add_reply(post_id: int, comment_id: int):
return redirect(url_for('post.continue_discussion', post_id=post_id, comment_id=reply.parent_id))
else:
form.notify_author.data = True
form.language_id.data = current_user.language_id if current_user.language_id else english_language_id()
form.language_id.data = current_user.language_id if current_user.is_authenticated and current_user.language_id else english_language_id()
return render_template('post/add_reply.html', title=_('Discussing %(title)s', title=post.title), post=post,
is_moderator=is_moderator, form=form, comment=in_reply_to, markdown_editor=current_user.is_authenticated and current_user.markdown_editor,