award refactor

remotes/1693045480750635534/spooky-22
Aevann1 2022-05-27 01:08:23 +02:00
parent 8eee22565d
commit 66b3efab36
9 changed files with 77 additions and 317 deletions

View File

@ -34,8 +34,8 @@ class Comment(Base):
top_comment_id = Column(Integer)
over_18 = Column(Boolean, default=False)
is_bot = Column(Boolean, default=False)
is_pinned = Column(String)
is_pinned_utc = Column(Integer)
stickied = Column(String)
stickied_utc = Column(Integer)
sentto = Column(Integer, ForeignKey("users.id"))
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
upvotes = Column(Integer, default=1)
@ -278,7 +278,7 @@ class Comment(Base):
'deleted_utc': self.deleted_utc,
'is_nsfw': self.over_18,
'permalink': f'/comment/{self.id}',
'is_pinned': self.is_pinned,
'stickied': self.stickied,
'distinguish_level': self.distinguish_level,
'post_id': self.post.id if self.post else 0,
'score': self.score,

View File

@ -1443,8 +1443,8 @@ def sticky_comment(cid, v):
comment = get_comment(cid, v=v)
if not comment.is_pinned:
comment.is_pinned = v.username
if not comment.stickied:
comment.stickied = v.username
g.db.add(comment)
ma=ModAction(
@ -1468,10 +1468,10 @@ def unsticky_comment(cid, v):
comment = get_comment(cid, v=v)
if comment.is_pinned:
if comment.is_pinned.endswith("(pin award)"): return {"error": "Can't unpin award pins!"}, 403
if comment.stickied:
if comment.stickied.endswith("(pin award)"): return {"error": "Can't unpin award pins!"}, 403
comment.is_pinned = None
comment.stickied = None
g.db.add(comment)
ma=ModAction(

View File

@ -124,11 +124,17 @@ def buy(v, award):
return {"message": "Award bought!"}
@app.post("/award_post/<pid>")
@app.post("/award/<thing_type>/<id>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
@is_not_permabanned
def award_post(pid, v):
def award_thing(v, thing_type, id):
if thing_type == 'post': thing = g.db.query(Submission).filter_by(id=id).one_or_none()
else: thing = g.db.query(Comment).filter_by(id=id).one_or_none()
if not thing: return {"error": f"That {thing_type} doesn't exist."}, 404
if v.shadowbanned: return render_template('errors/500.html', err=True, v=v), 500
kind = request.values.get("kind", "").strip()
@ -136,27 +142,24 @@ def award_post(pid, v):
if kind not in AWARDS:
return {"error": "That award doesn't exist."}, 404
post_award = g.db.query(AwardRelationship).filter(
award = g.db.query(AwardRelationship).filter(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
AwardRelationship.submission_id == None,
AwardRelationship.comment_id == None
).first()
if not post_award:
if not award:
return {"error": "You don't have that award."}, 404
post = g.db.query(Submission).filter_by(id=pid).one_or_none()
if thing_type == 'post': award.submission_id = thing.id
else: award.comment_id = thing.id
if not post:
return {"error": "That post doesn't exist."}, 404
post_award.submission_id = post.id
g.db.add(post_award)
g.db.add(award)
note = request.values.get("note", "").strip()
author = post.author
author = thing.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
@ -166,21 +169,21 @@ def award_post(pid, v):
if v.id != author.id:
if author.deflector and AWARDS[kind]['price'] > 500 and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
send_repeatable_notification(v.id, msg)
author = v
else:
msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!"
msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
if kind == "ban":
link = f"[this post]({post.shortlink})"
link = f"[this {thing_type}]({thing.shortlink})"
if not author.is_suspended:
author.ban(reason=f"1-Day ban award used by @{v.username} on /post/{post.id}", days=1)
author.ban(reason=f"1-Day ban award used by @{v.username} on /{thing_type}/{thing.id}", days=1)
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {link}. It sucked and you should feel bad.")
elif author.unban_utc:
author.unban_utc += 86400
@ -200,29 +203,29 @@ def award_post(pid, v):
send_repeatable_notification(author.id, "You have been unbanned!")
elif kind == "grass":
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on /post/{post.id}"
author.ban_reason = f"grass award used by @{v.username} on /{thing_type}/{thing.id}"
author.unban_utc = int(time.time()) + 30 * 86400
link = f"[this post]({post.shortlink})"
link = f"[this {thing_type}]({thing.shortlink})"
send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
if request.host == 'rdrama.net' and v.id == CARP_ID:
send_repeatable_notification(AEVANN_ID, link)
elif kind == "pin":
if post.stickied and post.stickied_utc:
post.stickied_utc += 3600
if thing.stickied and thing.stickied_utc:
thing.stickied_utc += 3600
else:
post.stickied = f'{v.username} (pin award)'
post.stickied_utc = int(time.time()) + 3600
g.db.add(post)
thing.stickied = f'{v.username} (pin award)'
thing.stickied_utc = int(time.time()) + 3600
g.db.add(thing)
cache.delete_memoized(frontlist)
elif kind == "unpin":
if not post.stickied_utc: abort(403)
t = post.stickied_utc - 3600
if not thing.stickied_utc: abort(403)
t = thing.stickied_utc - 3600
if time.time() > t:
post.stickied = None
post.stickied_utc = None
thing.stickied = None
thing.stickied_utc = None
cache.delete_memoized(frontlist)
else: post.stickied_utc = t
g.db.add(post)
else: thing.stickied_utc = t
g.db.add(thing)
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
if author.marseyawarded:
return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
@ -365,254 +368,11 @@ def award_post(pid, v):
g.db.commit()
if request.referrer and len(request.referrer) > 1:
if request.referrer == f'{SITE_FULL}/submit': return redirect(post.permalink)
if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink)
elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer)
return redirect(SITE_FULL)
@app.post("/award_comment/<cid>")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
@is_not_permabanned
def award_comment(cid, v):
if v.shadowbanned: return render_template('errors/500.html', err=True, v=v), 500
kind = request.values.get("kind", "").strip()
if kind not in AWARDS:
return {"error": "That award doesn't exist."}, 404
comment_award = g.db.query(AwardRelationship).filter(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
AwardRelationship.submission_id == None,
AwardRelationship.comment_id == None
).first()
if not comment_award:
return {"error": "You don't have that award."}, 404
c = g.db.query(Comment).filter_by(id=cid).one_or_none()
if not c:
return {"error": "That comment doesn't exist."}, 404
comment_award.comment_id = c.id
g.db.add(comment_award)
note = request.values.get("note", "").strip()
author = c.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if v.id != author.id:
if author.deflector and AWARDS[kind]['price'] > 500 and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
send_repeatable_notification(v.id, msg)
author = v
else:
msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if author.deflector: author = v
if kind == "ban":
link = f"[this comment]({c.shortlink})"
if not author.is_suspended:
author.ban(reason=f"1-Day ban award used by @{v.username} on /comment/{c.id}", days=1)
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {link}. It sucked and you should feel bad.")
elif author.unban_utc:
author.unban_utc += 86400
send_repeatable_notification(author.id, f"Your account has been banned for **yet another day** for {link}. Seriously man?")
if request.host == 'rdrama.net' and v.id == CARP_ID:
send_repeatable_notification(AEVANN_ID, link)
elif kind == "unban":
if not author.is_suspended or not author.unban_utc or time.time() > author.unban_utc: abort(403)
if author.unban_utc - time.time() > 86400:
author.unban_utc -= 86400
send_repeatable_notification(author.id, "Your ban duration has been reduced by 1 day!")
else:
author.unban_utc = 0
author.is_banned = 0
author.ban_evade = 0
send_repeatable_notification(author.id, "You have been unbanned!")
elif kind == "grass":
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on /comment/{c.id}"
author.unban_utc = int(time.time()) + 30 * 86400
link = f"[this comment]({c.shortlink})"
send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
if request.host == 'rdrama.net' and v.id == CARP_ID:
send_repeatable_notification(AEVANN_ID, link)
elif kind == "pin":
if c.is_pinned and c.is_pinned_utc: c.is_pinned_utc += 3600
else:
c.is_pinned = f'{v.username} (pin award)'
c.is_pinned_utc = int(time.time()) + 3600
g.db.add(c)
elif kind == "unpin":
if not c.is_pinned_utc: abort(403)
t = c.is_pinned_utc - 3600
if time.time() > t:
c.is_pinned = None
c.is_pinned_utc = None
else: c.is_pinned_utc = t
g.db.add(c)
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
if author.marseyawarded:
return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
else: author.agendaposter = int(time.time()) + 86400
if not author.has_badge(28):
badge = Badge(user_id=author.id, badge_id=28)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "flairlock":
new_name = note[:100].replace("𒐪","")
if not new_name and author.flairchanged:
author.flairchanged += 86400
else:
author.customtitleplain = new_name
author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400
if not author.has_badge(96):
badge = Badge(user_id=author.id, badge_id=96)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pause":
author.mute = True
if not author.has_badge(68):
new_badge = Badge(badge_id=68, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unpausable":
author.unmutable = True
if not author.has_badge(67):
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pizzashill":
if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "bird":
if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "eye":
author.eye = True
if not author.has_badge(83):
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "alt":
author.alt = True
if not author.has_badge(84):
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unblockable":
author.unblockable = True
if not author.has_badge(87):
new_badge = Badge(badge_id=87, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
author.fish = True
if not author.has_badge(90):
new_badge = Badge(badge_id=90, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
if author.patron_utc: author.patron_utc += 2629746
else: author.patron_utc = int(time.time()) + 2629746
author.procoins += 2500
if author.discord_id: add_role(author, "1")
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)
g.db.add(badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
if not author.has_badge(109):
badge = Badge(user_id=author.id, badge_id=109)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "deflector":
if author.deflector: author.deflector += 36000
else: author.deflector = int(time.time()) + 36000
elif kind == "beano":
if not author.has_badge(128):
badge = Badge(user_id=author.id, badge_id=128)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "checkmark":
author.verified = "Verified"
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1
g.db.add(author)
g.db.commit()
if request.referrer and len(request.referrer) > 1 and request.referrer.startswith(f'{SITE_FULL}/'):
return redirect(request.referrer)
return redirect(SITE_FULL)
@app.get("/admin/awards")
@admin_level_required(2)

View File

@ -896,11 +896,11 @@ def pin_comment(cid, v):
comment = get_comment(cid, v=v)
if not comment.is_pinned:
if not comment.stickied:
if v.id != comment.post.author_id: abort(403)
if comment.post.ghost: comment.is_pinned = "(OP)"
else: comment.is_pinned = v.username + " (OP)"
if comment.post.ghost: comment.stickied = "(OP)"
else: comment.stickied = v.username + " (OP)"
g.db.add(comment)
@ -919,13 +919,13 @@ def unpin_comment(cid, v):
comment = get_comment(cid, v=v)
if comment.is_pinned:
if comment.stickied:
if v.id != comment.post.author_id: abort(403)
if not comment.is_pinned.endswith(" (OP)"):
if not comment.stickied.endswith(" (OP)"):
return {"error": "You can only unpin comments you have pinned!"}
comment.is_pinned = None
comment.stickied = None
g.db.add(comment)
if v.id != comment.author_id:
@ -941,10 +941,10 @@ def mod_pin(cid, v):
comment = get_comment(cid, v=v)
if not comment.is_pinned:
if not comment.stickied:
if not (comment.post.sub and v.mods(comment.post.sub)): abort(403)
comment.is_pinned = v.username + " (Mod)"
comment.stickied = v.username + " (Mod)"
g.db.add(comment)
@ -962,10 +962,10 @@ def mod_unpin(cid, v):
comment = get_comment(cid, v=v)
if comment.is_pinned:
if comment.stickied:
if not (comment.post.sub and v.mods(comment.post.sub)): abort(403)
comment.is_pinned = None
comment.stickied = None
g.db.add(comment)
if v.id != comment.author_id:

View File

@ -181,9 +181,9 @@ def post_id(pid, anything=None, v=None, sub=None):
comment.is_blocked = c[3] or 0
output.append(comment)
pinned = [c[0] for c in comments.filter(Comment.is_pinned != None).all()]
pinned = [c[0] for c in comments.filter(Comment.stickied != None).all()]
comments = comments.filter(Comment.level == 1, Comment.is_pinned == None)
comments = comments.filter(Comment.level == 1, Comment.stickied == None)
if sort == "new":
comments = comments.order_by(Comment.created_utc.desc())
@ -200,9 +200,9 @@ def post_id(pid, anything=None, v=None, sub=None):
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
comments = first + second
else:
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.stickied != None).all()
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.is_pinned == None)
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.stickied == None)
if sort == "new":
comments = comments.order_by(Comment.created_utc.desc())
@ -243,9 +243,9 @@ def post_id(pid, anything=None, v=None, sub=None):
comments = comments2
for pin in pinned:
if pin.is_pinned_utc and int(time.time()) > pin.is_pinned_utc:
pin.is_pinned = None
pin.is_pinned_utc = None
if pin.stickied_utc and int(time.time()) > pin.stickied_utc:
pin.stickied = None
pin.stickied_utc = None
g.db.add(pin)
pinned.remove(pin)
@ -285,7 +285,7 @@ def viewmore(v, pid, sort, offset):
votes.c.vote_type,
blocking.c.target_id,
blocked.c.target_id,
).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.is_pinned == None, Comment.id.notin_(ids))
).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.stickied == None, Comment.id.notin_(ids))
if not (v and v.shadowbanned) and not (v and v.admin_level > 2):
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
@ -329,7 +329,7 @@ def viewmore(v, pid, sort, offset):
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
comments = first + second
else:
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.is_pinned == None, Comment.id.notin_(ids))
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.level == 1, Comment.stickied == None, Comment.id.notin_(ids))
if sort == "new":
comments = comments.order_by(Comment.created_utc.desc())
@ -532,7 +532,7 @@ def edit_post(pid, v):
over_18=False,
is_bot=True,
app_id=None,
is_pinned='AutoJanny',
stickied='AutoJanny',
distinguish_level=6,
body_html=body_jannied_html,
ghost=p.ghost
@ -1224,7 +1224,7 @@ def submit_post(v, sub=None):
over_18=False,
is_bot=True,
app_id=None,
is_pinned='AutoJanny',
stickied='AutoJanny',
distinguish_level=6,
body_html=body_jannied_html,
)

View File

@ -186,8 +186,8 @@
{% if c.active_flags(v) %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px"role="button" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Reports</a>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
{% if v and v.admin_level > 1 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shadowbanned by @{{c.author.shadowbanned}}"></i>{% endif %}
{% if c.is_pinned %}
<i id='pinned-{{c.id}}'class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{c.is_pinned}}" {% if c.is_pinned_utc %}onmouseover="pinned_timestamp('pinned-{{c.id}}')" data-timestamp={{c.is_pinned_utc}} {% endif %}></i>
{% if c.stickied %}
<i id='pinned-{{c.id}}'class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{c.stickied}}" {% if c.stickied_utc %}onmouseover="pinned_timestamp('pinned-{{c.id}}')" data-timestamp={{c.stickied_utc}} {% endif %}></i>
{% endif %}
{% if c.distinguish_level and not c.ghost %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{SITE_NAME}} Admin, speaking officially"></i>{% endif %}
{% if c.is_op %}<i class="fas fa-microphone-stand text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="OP"></i>{% endif %}
@ -441,7 +441,7 @@
<button class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
<button class="btn caction py-0 nobackground px-1 text-muted" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award_comment/{{c.id}}"><i class="fas fa-gift" aria-hidden="true"></i>Give Award</button>
<button class="btn caction py-0 nobackground px-1 text-muted" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award/comment/{{c.id}}"><i class="fas fa-gift" aria-hidden="true"></i>Give Award</button>
<button id="unsave-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id in v.saved_comment_idlist() %}d-md-inline-block{% endif %} text-muted d-none" role="button" onclick="post_toast3(this,'/unsave_comment/{{c.id}}','save-{{c.id}}','unsave-{{c.id}}')"><i class="fas fa-save"></i>Unsave</button>
@ -486,9 +486,9 @@
{% endif %}
{% if url != "" %}
<button id="unpin-{{c.id}}" class="dropdown-item list-inline-item {% if c.is_pinned %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3(this,'/un{{url}}/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</button>
<button id="unpin-{{c.id}}" class="dropdown-item list-inline-item {% if c.stickied %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3(this,'/un{{url}}/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</button>
<button id="pin-{{c.id}}" class="dropdown-item list-inline-item {% if not c.is_pinned %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3(this,'/{{url}}/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button>
<button id="pin-{{c.id}}" class="dropdown-item list-inline-item {% if not c.stickied %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3(this,'/{{url}}/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button>
{% endif %}
{% endif %}
@ -641,7 +641,7 @@
{% if v %}
<a role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}')" class="list-group-item"><i class="fas fa-flag mr-2"></i>Report</a>
<a class="list-group-item" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award_comment/{{c.id}}"><i class="fas fa-gift mr-2" aria-hidden="true"></i>Give Award</a>
<a class="list-group-item" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url="/award/comment/{{c.id}}"><i class="fas fa-gift mr-2" aria-hidden="true"></i>Give Award</a>
<a id="save2-{{c.id}}" class="list-group-item {% if c.id in v.saved_comment_idlist() %}d-none{% endif %}" role="button" data-bs-dismiss="modal" onclick="post_toast2(this,'/save_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')"><i class="fas fa-save mr-2"></i>Save</a>
@ -675,11 +675,11 @@
{% if v.admin_level < 2 %}
{% if c.post and v.id == c.post.author_id %}
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/unpin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
<a id="pin2-{{c.id}}" class="list-group-item {% if c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/unpin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
{% elif c.post.sub and v.mods(c.post.sub) %}
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/mod_pin/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/mod_unpin/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
<a id="pin2-{{c.id}}" class="list-group-item {% if c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/mod_pin/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/mod_unpin/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
{% endif %}
{% endif %}
@ -720,8 +720,8 @@
<a id="undistinguish2-{{c.id}}" class="list-group-item {% if not c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="post_toast2(this,'/distinguish_comment/{{c.id}}','distinguish2-{{c.id}}','undistinguish2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Undistinguish</a>
{% endif %}
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="post_toast2(this,'/sticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="post_toast2(this,'/unsticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
<a id="pin2-{{c.id}}" class="list-group-item {% if c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="post_toast2(this,'/sticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="post_toast2(this,'/unsticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
<a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast2(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a>
<a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast2(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a>

View File

@ -9,7 +9,7 @@
{% if not p.ghost or v.id == AEVANN_ID %}<a class="list-inline-item" href="/votes?link={{p.fullname}}"><i class="fas fa-arrows-v"></i>Votes</a>{% endif %}
{% if v %}
<a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award_post/{{p.id}}'><i class="fas fa-gift fa-fw"></i>Give Award</a>
<a class="list-inline-item text-muted d-none d-md-inline-block" role="button" data-bs-toggle="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}'><i class="fas fa-gift fa-fw"></i>Give Award</a>
{% endif %}
<a class="list-inline-item copy-link" role="button" data-clipboard-text="{% if request.host == 'rdrama.net' %}https://chapotraphouse.club{{p.shortlink}}{% else %}{{p.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</a>

View File

@ -12,7 +12,7 @@
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="far fa-flag text-center text-muted mr-3"></i>Report</button>
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#awardModal" data-url='/award_post/{{p.id}}'><i class="fas fa-gift text-center text-muted mr-3"></i>Give Award</button>
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#awardModal" data-url='/award/post/{{p.id}}'><i class="fas fa-gift text-center text-muted mr-3"></i>Give Award</button>
<button id="subscribe2-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="post_toast2(this,'/subscribe/{{p.id}}','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye text-center text-muted mr-3"></i>Subscribe</button>
<button id="unsubscribe2-{{p.id}}" class="{% if not p.id in v.subscribed_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="post_toast2(this,'/unsubscribe/{{p.id}}','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash text-center text-muted mr-3"></i>Unsubscribe</button>

View File

@ -273,13 +273,13 @@ CREATE TABLE public.comments (
app_id integer,
sentto integer,
bannedfor boolean,
is_pinned character varying(40),
stickied character varying(40),
body character varying(10000),
body_html character varying(40000),
ban_reason character varying(25),
realupvotes integer DEFAULT 1 NOT NULL,
top_comment_id integer,
is_pinned_utc integer,
stickied_utc integer,
ghost boolean DEFAULT false NOT NULL,
slots_result character varying(32),
blackjack_result character varying(860),