rename to textlink

pull/225/head
Aevann 2024-02-20 02:00:21 +02:00
parent 923dd811f4
commit fe3c1321da
8 changed files with 29 additions and 29 deletions

View File

@ -317,7 +317,7 @@ class Comment(Base):
@property
@lazy
def text_permalink(self):
def textlink(self):
return f"[your comment]({self.shortlink})"
@property

View File

@ -155,7 +155,7 @@ class Post(Base):
@property
@lazy
def text_permalink(self):
def textlink(self):
return f"[{self.title}]({self.shortlink})"
@property

View File

@ -48,7 +48,7 @@ def archive_url(url):
def snappy_report(post, reason):
report = Report(post_id=post.id, user_id=SNAPPY_ID, reason=reason)
g.db.add(report)
message = f'@Snappy reported {post.text_permalink})\n\n> {reason}'
message = f'@Snappy reported {post.textlink})\n\n> {reason}'
send_repeatable_notification(post.author_id, message)
def execute_snappy(post, v):
@ -166,7 +166,7 @@ def execute_snappy(post, v):
awarded_coins = int(AWARDS["glowie"]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
post.author.pay_account('coins', awarded_coins)
msg = f"@Snappy has given {post.text_permalink} the Glowie Award and you have received {awarded_coins} coins as a result!"
msg = f"@Snappy has given {post.textlink} the Glowie Award and you have received {awarded_coins} coins as a result!"
send_repeatable_notification(post.author.id, msg)
elif body.startswith("You're a chud, CHUD I tell you"):
award_object = AwardRelationship(
@ -178,7 +178,7 @@ def execute_snappy(post, v):
)
g.db.add(award_object)
msg = f"@Snappy has given {post.text_permalink} the Chud Award\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**\n\n> Trans lives matter"
msg = f"@Snappy has given {post.textlink} the Chud Award\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**\n\n> Trans lives matter"
send_repeatable_notification(post.author.id, msg)
if v.chud != 1:

View File

@ -1466,7 +1466,7 @@ def pin_post(post_id, v):
pin_time = 'for 1 hour'
code = 200
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has pinned {post.text_permalink}")
send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has pinned {post.textlink}")
else:
if pins >= PIN_LIMIT + 1:
abort(403, f"Can't exceed {PIN_LIMIT} pinned posts limit!")
@ -1515,7 +1515,7 @@ def unpin_post(post_id, v):
g.db.add(ma)
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has unpinned {post.text_permalink}")
send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has unpinned {post.textlink}")
cache.delete_memoized(frontlist)
return {"message": "Post unpinned!"}
@ -1547,7 +1547,7 @@ def pin_comment_admin(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
message = f"@{v.username} (a site admin) has pinned {comment.text_permalink}"
message = f"@{v.username} (a site admin) has pinned {comment.textlink}"
send_repeatable_notification(comment.author_id, message)
comment.pin_parents()
@ -1580,7 +1580,7 @@ def unpin_comment_admin(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
message = f"@{v.username} (a site admin) has unpinned {comment.text_permalink}"
message = f"@{v.username} (a site admin) has unpinned {comment.textlink}"
send_repeatable_notification(comment.author_id, message)
comment.unpin_parents()

View File

@ -222,7 +222,7 @@ def award_thing(v, thing_type, id):
if v.id != author.id:
if author.deflector and v.deflector and AWARDS[kind]['deflectable']:
msg = f"@{v.username} has tried to give {obj.text_permalink} the {award_title} Award but it was deflected on them, they also had a deflector up, so it bounced back and forth until it vaporized!"
msg = f"@{v.username} has tried to give {obj.textlink} the {award_title} Award but it was deflected on them, they also had a deflector up, so it bounced back and forth until it vaporized!"
send_repeatable_notification(author.id, msg)
msg = f"{safe_username} under the effect of a deflector award; your {award_title} Award has been deflected back to you but your deflector protected you, the award bounced back and forth until it vaporized!"
@ -271,10 +271,10 @@ def award_thing(v, thing_type, id):
if kind == "ban":
if not author.is_suspended:
author.ban(reason=ban_reason, days=1)
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {obj.text_permalink}. It sucked and you should feel bad.")
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for {obj.textlink}. 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 {obj.text_permalink}. Seriously man?")
send_repeatable_notification(author.id, f"Your account has been banned for **yet another day** for {obj.textlink}. Seriously man?")
elif kind == "unban":
if not author.is_suspended or not author.unban_utc:
abort(403)
@ -293,7 +293,7 @@ def award_thing(v, thing_type, id):
elif kind == "grass":
author.is_banned = AUTOJANNY_ID
author.unban_utc = int(time.time()) + 30 * 86400
send_repeatable_notification(author.id, f"@{v.username} gave you the grass award on {obj.text_permalink} and as a result you have been banned! You must [send the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
send_repeatable_notification(author.id, f"@{v.username} gave you the grass award on {obj.textlink} and as a result you have been banned! You must [send the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
elif kind == "pin":
if not FEATURES['PINS']: abort(403)
if obj.is_banned: abort(403)
@ -597,7 +597,7 @@ def award_thing(v, thing_type, id):
author = obj.author
if v.id != author.id:
if author.deflector and AWARDS[kind]['deflectable']:
msg = f"@{v.username} has tried to give {obj.text_permalink} the {award_title} Award but it was deflected and applied to them :marseytroll:"
msg = f"@{v.username} has tried to give {obj.textlink} the {award_title} Award but it was deflected and applied to them :marseytroll:"
n = send_repeatable_notification(author.id, msg)
if n: n.created_utc -= 2
@ -605,7 +605,7 @@ def award_thing(v, thing_type, id):
n = send_repeatable_notification(v.id, msg)
if n: n.created_utc -= 2
elif kind not in {'spider', 'jumpscare'}:
msg = f"@{v.username} has given {obj.text_permalink} the {award_title} Award"
msg = f"@{v.username} has given {obj.textlink} the {award_title} Award"
if kind == 'shit':
msg += f" and has stolen from you {awarded_coins} coins as a result"

View File

@ -509,8 +509,8 @@ def pin_comment_op(cid, v):
comment.pin_parents()
if v.id != comment.author_id:
if comment.post.ghost: message = f"OP has pinned {comment.text_permalink}"
else: message = f"@{v.username} (OP) has pinned {comment.text_permalink}"
if comment.post.ghost: message = f"OP has pinned {comment.textlink}"
else: message = f"@{v.username} (OP) has pinned {comment.textlink}"
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment pinned!"}
@ -539,7 +539,7 @@ def unpin_comment_op(cid, v):
comment.unpin_parents()
if v.id != comment.author_id:
message = f"@{v.username} (OP) has unpinned {comment.text_permalink}"
message = f"@{v.username} (OP) has unpinned {comment.textlink}"
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment unpinned!"}

View File

@ -34,7 +34,7 @@ def exile_post(v, pid):
exile = Exile(user_id=u.id, hole=hole, exiler_id=v.id)
g.db.add(exile)
send_notification(u.id, f"@{v.username} has exiled you from /h/{hole} for {p.text_permalink}")
send_notification(u.id, f"@{v.username} has exiled you from /h/{hole} for {p.textlink}")
ma = HoleAction(
hole=hole,
@ -73,7 +73,7 @@ def exile_comment(v, cid):
exile = Exile(user_id=u.id, hole=hole, exiler_id=v.id)
g.db.add(exile)
send_notification(u.id, f"@{v.username} has exiled you from /h/{hole} for {c.text_permalink}")
send_notification(u.id, f"@{v.username} has exiled you from /h/{hole} for {c.textlink}")
ma = HoleAction(
hole=hole,
@ -435,7 +435,7 @@ def kick(v, pid):
g.db.add(ma)
if v.id != post.author_id:
message = f"@{v.username} (a /h/{old} mod) has moved {post.text_permalink} from /h/{old} to the main feed!"
message = f"@{v.username} (a /h/{old} mod) has moved {post.textlink} from /h/{old} to the main feed!"
send_repeatable_notification(post.author_id, message)
g.db.add(post)
@ -771,7 +771,7 @@ def hole_pin(v, pid):
g.db.add(p)
if v.id != p.author_id:
message = f"@{v.username} (a /h/{p.hole} mod) has pinned {p.text_permalink} in /h/{p.hole}"
message = f"@{v.username} (a /h/{p.hole} mod) has pinned {p.textlink} in /h/{p.hole}"
send_repeatable_notification(p.author_id, message)
ma = HoleAction(
@ -803,7 +803,7 @@ def hole_unpin(v, pid):
g.db.add(p)
if v.id != p.author_id:
message = f"@{v.username} (a /h/{p.hole} mod) has unpinned {p.text_permalink} in /h/{p.hole}"
message = f"@{v.username} (a /h/{p.hole} mod) has unpinned {p.textlink} in /h/{p.hole}"
send_repeatable_notification(p.author_id, message)
ma = HoleAction(
@ -918,7 +918,7 @@ def pin_comment_mod(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
message = f"@{v.username} (a /h/{comment.post.hole} mod) has pinned {comment.text_permalink}"
message = f"@{v.username} (a /h/{comment.post.hole} mod) has pinned {comment.textlink}"
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment pinned!"}
@ -951,7 +951,7 @@ def unpin_comment_mod(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
message = f"@{v.username} (a /h/{comment.post.hole} mod) has unpinned {comment.text_permalink}"
message = f"@{v.username} (a /h/{comment.post.hole} mod) has unpinned {comment.textlink}"
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment unpinned!"}
@ -1139,7 +1139,7 @@ def change_hole(pid, v):
else:
hole_from_in_notif = f'/h/{hole_from}'
message = f"@{v.username} ({position}) has moved {post.text_permalink} from {hole_from_in_notif} to {hole_to_in_notif}"
message = f"@{v.username} ({position}) has moved {post.textlink} from {hole_from_in_notif} to {hole_to_in_notif}"
send_repeatable_notification(post.author_id, message)
cache.delete_memoized(frontlist)

View File

@ -55,7 +55,7 @@ def report_post(pid, v):
position = f'a /h/{post.hole} mod'
if v.id != post.author_id:
message = f'@{v.username} ({position}) has flaired {post.text_permalink} with the flair: `"{og_flair}"`'
message = f'@{v.username} ({position}) has flaired {post.textlink} with the flair: `"{og_flair}"`'
send_repeatable_notification(post.author_id, message)
return {"message": "Post flaired successfully!"}
@ -68,7 +68,7 @@ def report_post(pid, v):
g.db.add(report)
if v.id != post.author_id and not post.author.has_blocked(v) and not post.author.has_muted(v):
message = f'@{v.username} reported {post.text_permalink}\n\n> {reason}'
message = f'@{v.username} reported {post.textlink}\n\n> {reason}'
send_repeatable_notification(post.author_id, message)
return {"message": "Post reported!"}
@ -103,7 +103,7 @@ def report_comment(cid, v):
g.db.add(report)
if v.id != comment.author_id and not comment.author.has_blocked(v) and not comment.author.has_muted(v):
message = f'@{v.username} reported {comment.text_permalink}\n\n> {reason}'
message = f'@{v.username} reported {comment.textlink}\n\n> {reason}'
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment reported!"}