forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-02-21 03:35:01 +02:00
parent 7fa3bb87ca
commit b48cc5314f
7 changed files with 14 additions and 14 deletions

View File

@ -93,7 +93,7 @@ def send_admin(id, body_html, vid=None):
new_comment = Comment(author_id=id,
parent_submission=None,
level=1,
sentto=0,
sentto=2,
body_html=body_html,
)
g.db.add(new_comment)

View File

@ -493,7 +493,7 @@ def under_attack(v):
@app.get("/admin/badge_grant")
@admin_level_required(2)
def badge_grant_get(v):
badges = g.db.query(BadgeDef).all()
badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all()
return render_template("admin/badge_grant.html", v=v, badge_types=badges)
@ -501,7 +501,7 @@ def badge_grant_get(v):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def badge_grant_post(v):
badges = g.db.query(BadgeDef).all()
badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all()
user = get_user(request.values.get("username").strip(), graceful=True)
if not user:
@ -546,7 +546,7 @@ def badge_grant_post(v):
@app.get("/admin/badge_remove")
@admin_level_required(2)
def badge_remove_get(v):
badges = g.db.query(BadgeDef).all()
badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all()
return render_template("admin/badge_remove.html", v=v, badge_types=badges)
@ -555,7 +555,7 @@ def badge_remove_get(v):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def badge_remove_post(v):
badges = g.db.query(BadgeDef).all()
badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all()
user = get_user(request.values.get("username").strip(), graceful=True)
if not user:

View File

@ -42,7 +42,7 @@ def notifications(v):
modmail = request.values.get('modmail')
posts = request.values.get('posts')
if modmail and v.admin_level > 1:
comments = g.db.query(Comment).filter(Comment.sentto==0).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all()
comments = g.db.query(Comment).filter(Comment.sentto==2).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all()
next_exists = (len(comments) > 25)
comments = comments[:25]
elif messages:

View File

@ -766,7 +766,7 @@ def thumbnail_thread(pid):
body_html = sanitize(f'New {word} mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).one_or_none()
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=2).one_or_none()
if existing_comment: break
@ -817,7 +817,7 @@ def thumbnail_thread(pid):
for i in data:
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).one_or_none()
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=2).one_or_none()
if existing_comment: break
@ -826,7 +826,7 @@ def thumbnail_thread(pid):
distinguish_level=6,
body_html=body_html,
level=1,
sentto=0,
sentto=2,
)
db.add(new_comment)
db.flush()

View File

@ -358,7 +358,7 @@ def robots_txt():
@app.get("/badges")
@auth_required
def badges(v):
badges = g.db.query(BadgeDef).all()
badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all()
return render_template("badges.html", v=v, badges=badges)

View File

@ -590,7 +590,7 @@ def messagereply(v):
except: pass
if new_comment.top_comment.sentto == 0:
if new_comment.top_comment.sentto == 2:
admins = g.db.query(User).filter(User.admin_level > 2, User.id != v.id, User.id != user_id).all()
for admin in admins:
notif = Notification(comment_id=new_comment.id, user_id=admin.id)

View File

@ -157,7 +157,7 @@
{% elif c.author_id==NOTIFICATIONS_ID or c.author_id==AUTOJANNY_ID %}
<span class="font-weight-bold">Notification</span>
{% else %}
{% if c.sentto == 0 %}
{% if c.sentto == 2 %}
<span class="font-weight-bold">Sent to admins</span>
{% else %}
<span class="font-weight-bold">Sent to @{{c.senttouser.username}}</span>
@ -167,7 +167,7 @@
</div>
{% endif %}
{% if c.sentto and c.level > 1 and c.created_utc > 1641340623 %}
{% if c.sentto and c.level > 1 %}
{% set isreply = True %}
{% else %}
{% set isreply = False %}
@ -639,7 +639,7 @@
</div>
{% endif %}
{% if request.path == '/notifications' and c.level == 1 and c.sentto != None and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %}
{% if request.path == '/notifications' and c.level == 1 and c.sentto and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %}
<a class="btn btn-primary" role="button" onclick="openReplyBox('reply-message-{{c.id}}')">Reply</a>
<pre></pre>
<div id="reply-message-{{c.id}}" class="d-none">