hide community selection when editing post

This commit is contained in:
rimu 2024-03-12 21:34:10 +13:00
parent 49db71e05d
commit 5ab1082551
2 changed files with 14 additions and 5 deletions

View file

@ -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)

View file

@ -43,7 +43,6 @@
<h1>{{ _('Edit post') }}</h1>
<form method="post" enctype="multipart/form-data" role="form">
{{ form.csrf_token() }}
{{ render_field(form.communities) }}
<nav id="post_type_chooser">
<div class="nav nav-tabs nav-justified" id="typeTab" role="tablist">
<button class="nav-link active" id="discussion-tab" data-bs-toggle="tab" data-bs-target="#discussion-tab-pane"
@ -143,11 +142,20 @@
<h2>{{ post.community.title }}</h2>
</div>
<div class="card-body">
<p>{{ post.community.description|safe }}</p>
<p>{{ post.community.rules|safe }}</p>
<p>{{ post.community.description_html|safe if post.community.description_html else '' }}</p>
<p>{{ post.community.rules_html|safe if post.community.rules_html else '' }}</p>
{% if len(mods) > 0 and not post.community.private_mods %}
<h3>Moderators</h3>
<ul class="moderator_list">
{% for mod in mods %}
<li><a href="/u/{{ mod.link() }}">{{ mod.display_name() }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% include "_inoculation_links.html" %}
</aside>
{% include "_inoculation_links.html" %}
</div>
{% endblock %}