mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
admins can delete anything
This commit is contained in:
parent
147ff51189
commit
40f53d9cd3
3 changed files with 4 additions and 2 deletions
|
@ -587,7 +587,7 @@ def post_edit(post_id: int):
|
|||
def post_delete(post_id: int):
|
||||
post = Post.query.get_or_404(post_id)
|
||||
community = post.community
|
||||
if post.user_id == current_user.id or community.is_moderator():
|
||||
if post.user_id == current_user.id or community.is_moderator() or current_user.is_admin():
|
||||
post.delete_dependencies()
|
||||
post.flush_cache()
|
||||
db.session.delete(post)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="card-title">{{ _('Options for "%(post_title)s"', post_title=post.title) }}</div>
|
||||
<ul class="option_list">
|
||||
{% if current_user.is_authenticated %}
|
||||
{% if post.user_id == current_user.id or post.community.is_moderator() %}
|
||||
{% if post.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin() %}
|
||||
<li><a href="{{ url_for('post.post_edit', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-edit"></span>
|
||||
{{ _('Edit') }}</a></li>
|
||||
<li><a href="{{ url_for('post.post_delete', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
|
|
|
@ -151,6 +151,8 @@ def is_image_url(url):
|
|||
|
||||
# sanitise HTML using an allow list
|
||||
def allowlist_html(html: str) -> str:
|
||||
if html is None or html == '':
|
||||
return ''
|
||||
allowed_tags = ['p', 'strong', 'a', 'ul', 'ol', 'li', 'em', 'blockquote', 'cite', 'br', 'h3', 'h4', 'h5', 'pre',
|
||||
'code', 'img']
|
||||
# Parse the HTML using BeautifulSoup
|
||||
|
|
Loading…
Add table
Reference in a new issue