From 5ab1082551de315fd1d181acb4b0335c022ae72f Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:34:10 +1300 Subject: [PATCH] hide community selection when editing post --- app/post/routes.py | 3 ++- app/templates/post/post_edit.html | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/post/routes.py b/app/post/routes.py index 67472b84..eef451ea 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -604,6 +604,7 @@ def post_reply_options(post_id: int, comment_id: int): def post_edit(post_id: int): post = Post.query.get_or_404(post_id) form = CreatePostForm() + del form.communities if post.user_id == current_user.id or post.community.is_moderator(): if g.site.enable_nsfl is False: form.nsfl.render_kw = {'disabled': True} @@ -614,7 +615,7 @@ def post_edit(post_id: int): form.nsfl.data = True form.nsfw.render_kw = {'disabled': True} - form.communities.choices = [(c.id, c.display_name()) for c in current_user.communities()] + #form.communities.choices = [(c.id, c.display_name()) for c in current_user.communities()] if form.validate_on_submit(): save_post(form, post) diff --git a/app/templates/post/post_edit.html b/app/templates/post/post_edit.html index 99757bf5..6c5581aa 100644 --- a/app/templates/post/post_edit.html +++ b/app/templates/post/post_edit.html @@ -43,7 +43,6 @@

{{ _('Edit post') }}

{{ form.csrf_token() }} - {{ render_field(form.communities) }}