mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
nsfw and nsfl icons on posts - editing
This commit is contained in:
parent
066646b4f6
commit
e1c86371a6
2 changed files with 9 additions and 6 deletions
|
@ -559,11 +559,14 @@ def post_edit(post_id: int):
|
|||
post = Post.query.get_or_404(post_id)
|
||||
form = CreatePostForm()
|
||||
if post.user_id == current_user.id or post.community.is_moderator():
|
||||
if get_setting('allow_nsfw', False) is False:
|
||||
form.nsfw.render_kw = {'disabled': True}
|
||||
if get_setting('allow_nsfl', False) is False:
|
||||
if g.site.enable_nsfl is False:
|
||||
form.nsfl.render_kw = {'disabled': True}
|
||||
images_disabled = 'disabled' if not get_setting('allow_local_image_posts', True) else ''
|
||||
if post.community.nsfw:
|
||||
form.nsfw.data = True
|
||||
form.nsfw.render_kw = {'disabled': True}
|
||||
if post.community.nsfl:
|
||||
form.nsfl.data = True
|
||||
form.nsfw.render_kw = {'disabled': True}
|
||||
|
||||
form.communities.choices = [(c.id, c.display_name()) for c in current_user.communities()]
|
||||
|
||||
|
@ -669,7 +672,7 @@ def post_edit(post_id: int):
|
|||
form.image_alt_text.data = post.image.alt_text
|
||||
form.notify_author.data = post.notify_author
|
||||
return render_template('post/post_edit.html', title=_('Edit post'), form=form, post=post,
|
||||
images_disabled=images_disabled, markdown_editor=True,
|
||||
markdown_editor=True,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id()),
|
||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<button class="nav-link" id="link-tab" data-bs-toggle="tab" data-bs-target="#link-tab-pane"
|
||||
type="button" role="tab" aria-controls="link-tab-pane" aria-selected="false">Link</button>
|
||||
<button class="nav-link" id="image-tab" data-bs-toggle="tab" data-bs-target="#image-tab-pane"
|
||||
type="button" role="tab" aria-controls="image-tab-pane" aria-selected="false" {{ images_disabled }}>Image</button>
|
||||
type="button" role="tab" aria-controls="image-tab-pane" aria-selected="false">Image</button>
|
||||
<button class="nav-link" id="poll-tab" data-bs-toggle="tab" data-bs-target="#poll-tab-pane"
|
||||
type="button" role="tab" aria-controls="poll-tab-pane" aria-selected="false" disabled>Poll</button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue