diff --git a/files/classes/user.py b/files/classes/user.py index 04d1c63ae..d95a2d89e 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -481,7 +481,8 @@ class User(Base): Submission.deleted_utc == 0, Submission.is_banned == False, Submission.private == False, - Submission.author_id != self.id + Submission.author_id != self.id, + Submission.ghost == False ).count() @property diff --git a/files/routes/admin.py b/files/routes/admin.py index 57845ba11..6206c086e 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -146,41 +146,6 @@ def merge_all(v, id): return redirect(user.url) - -if SITE_NAME == 'PCM': - @app.get('/admin/sidebar') - @admin_level_required(3) - def get_sidebar(v): - - try: - with open(f'files/templates/sidebar_{SITE_NAME}.html', 'r', encoding="utf-8") as f: sidebar = f.read() - except: - sidebar = None - - return render_template('admin/sidebar.html', v=v, sidebar=sidebar) - - - @app.post('/admin/sidebar') - @limiter.limit("1/second;30/minute;200/hour;1000/day") - @admin_level_required(3) - def post_sidebar(v): - - text = request.values.get('sidebar', '').strip() - - with open(f'files/templates/sidebar_{SITE_NAME}.html', 'w+', encoding="utf-8") as f: f.write(text) - - with open(f'files/templates/sidebar_{SITE_NAME}.html', 'r', encoding="utf-8") as f: sidebar = f.read() - - ma = ModAction( - kind="change_sidebar", - user_id=v.id, - ) - g.db.add(ma) - - - return render_template('admin/sidebar.html', v=v, sidebar=sidebar, msg='Sidebar edited successfully!') - - @app.post("/@/make_admin") @admin_level_required(3) def make_admin(v, username): @@ -290,6 +255,7 @@ def revert_actions(v, username): for item in posts + comments: item.is_banned = False item.ban_reason = None + item.is_approved = v.id g.db.add(item) users = (x[0] for x in g.db.query(ModAction.target_user_id).filter(ModAction.user_id == user.id, ModAction.created_utc > cutoff, ModAction.kind.in_(('shadowban', 'ban_user'))).all()) @@ -1049,9 +1015,9 @@ def ban_user(user_id, v): send_repeatable_notification(user.id, text) - if days == 0: duration = "permanent" - elif days == 1: duration = "1 day" - else: duration = f"{days} days" + if days == 0: duration = "permanently" + elif days == 1: duration = "for 1 day" + else: duration = f"for {days} days" note = f'reason: "{reason}", duration: {duration}' ma=ModAction( @@ -1523,6 +1489,7 @@ def admin_nunuke_user(v): post.is_banned = False post.ban_reason = None + post.is_approved = v.id g.db.add(post) for comment in g.db.query(Comment).filter_by(author_id=user.id).all(): @@ -1531,6 +1498,7 @@ def admin_nunuke_user(v): comment.is_banned = False comment.ban_reason = None + comment.is_approved = v.id g.db.add(comment) ma=ModAction( diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 601f7a0d4..2ea025305 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -102,6 +102,7 @@ def notifications_posts(v): Submission.is_banned == False, Submission.private == False, Submission.author_id != v.id, + Submission.ghost == False ).order_by(Submission.created_utc.desc()).offset(25 * (page - 1)).limit(26).all()] next_exists = (len(listing) > 25) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index c2a4921bd..1a026e238 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -61,16 +61,10 @@
  • Daily Stat Chart
  • -{% if SITE_NAME in ['PCM', 'WPD'] -%} -

    Configuration

    - -{%- endif %} +

    Configuration

    + {% if v.admin_level > 2 %}
    
    diff --git a/files/templates/admin/sidebar.html b/files/templates/admin/sidebar.html
    deleted file mode 100644
    index 77b6c49b6..000000000
    --- a/files/templates/admin/sidebar.html
    +++ /dev/null
    @@ -1,42 +0,0 @@
    -{% extends "default.html" %}
    -
    -{% block pagetitle %}Edit {{SITE_NAME}} sidebar{% endblock %}
    -
    -{% block content %}
    -
    -{% if msg %}
    -	
    -{% endif %}
    -
    -
    -
    -
    -
    -

    Edit Sidebar

    -
    -
    -
    -
    -
    - - - -
    - -
    -
    -
    -
    -
    -
    -
    - -{% endblock %} \ No newline at end of file diff --git a/files/templates/comments.html b/files/templates/comments.html index c6ef8d097..e054e7f88 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -175,7 +175,7 @@ {% endif %} {% if c.bannedfor %} - + {% endif %} {% if c.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{c.active_flags(v)}} Report{{ help.plural(c.active_flags(v)) }}{% endif %} {% if c.over_18 %}+18{% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 8189dbd20..64b41114a 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -636,7 +636,7 @@ {% endif %} {% if p.bannedfor %} - + {% endif %} {% for a in p.awards %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index ddaec44f1..35591eab1 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -163,7 +163,7 @@ {% endif %} {% if p.bannedfor %} - + {% endif %} {% for a in p.awards %}