add "(Admin)" to messages sent to users due to admin actions (for clarity to new users)

master
Aevann1 2022-10-10 08:11:17 +02:00
parent 592c144454
commit 356c9f1219
5 changed files with 28 additions and 28 deletions

View File

@ -283,7 +283,7 @@ def revert_actions(v, username):
user.ban_reason = None
if user.is_banned:
user.is_banned = 0
send_repeatable_notification(user.id, f"@{v.username} has unbanned you!")
send_repeatable_notification(user.id, f"@{v.username} (Admin) has unbanned you!")
g.db.add(user)
for u in user.alts:
@ -292,7 +292,7 @@ def revert_actions(v, username):
u.ban_reason = None
if u.is_banned:
u.is_banned = 0
send_repeatable_notification(u.id, f"@{v.username} has unbanned you!")
send_repeatable_notification(u.id, f"@{v.username} (Admin) has unbanned you!")
g.db.add(u)
return {"message": f"@{user.username}'s admin actions have been reverted!"}
@ -319,7 +319,7 @@ def club_allow(v, username):
)
g.db.add(ma)
send_repeatable_notification(u.id, f"@{v.username} (admin) has inducted you into the {CC_TITLE}!")
send_repeatable_notification(u.id, f"@{v.username} (Admin) has inducted you into the {CC_TITLE}!")
return {"message": f"@{u.username} has been allowed into the {CC_TITLE}!"}
@ -344,7 +344,7 @@ def club_ban(v, username):
)
g.db.add(ma)
send_repeatable_notification(u.id, f"@{v.username} (admin) has disallowed you from the {CC_TITLE}!")
send_repeatable_notification(u.id, f"@{v.username} (Admin) has disallowed you from the {CC_TITLE}!")
return {"message": f"@{u.username} has been disallowed from the {CC_TITLE}. Deserved."}
@ -565,7 +565,7 @@ def badge_grant_post(v):
g.db.flush()
if v.id != user.id:
text = f"@{v.username} has given you the following profile badge:\n\n![]({new_badge.path})\n\n**{new_badge.name}**\n\n{new_badge.badge.description}"
text = f"@{v.username} (Admin) has given you the following profile badge:\n\n![]({new_badge.path})\n\n**{new_badge.name}**\n\n{new_badge.badge.description}"
send_repeatable_notification(user.id, text)
ma = ModAction(
@ -612,7 +612,7 @@ def badge_remove_post(v):
return render_template("admin/badge_remove.html", v=v, badge_types=badges, error="User doesn't have that badge.")
if v.id != user.id:
text = f"@{v.username} has removed the following profile badge from you:\n\n![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}"
text = f"@{v.username} (Admin) has removed the following profile badge from you:\n\n![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}"
send_repeatable_notification(user.id, text)
ma = ModAction(
@ -868,7 +868,7 @@ def agendaposter(user_id, v):
badge_grant(user=user, badge_id=28)
send_repeatable_notification(user.id, f"@{v.username} has marked you as a chud ({note}).")
send_repeatable_notification(user.id, f"@{v.username} (Admin) has marked you as a chud ({note}).")
return redirect(user.url)
@ -898,7 +898,7 @@ def unagendaposter(user_id, v):
badge = user.has_badge(28)
if badge: g.db.delete(badge)
send_repeatable_notification(user.id, f"@{v.username} has unmarked you as a chud.")
send_repeatable_notification(user.id, f"@{v.username} (Admin) has unmarked you as a chud.")
return {"message": f"@{user.username}'s chud theme has been disabled!"}
@ -1018,11 +1018,11 @@ def ban_user(user_id, v):
if days:
days_txt = str(days).rstrip('.0')
if reason: text = f"@{v.username} has banned you for **{days_txt}** days for the following reason:\n\n> {reason}"
else: text = f"@{v.username} has banned you for **{days_txt}** days."
if reason: text = f"@{v.username} (Admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}"
else: text = f"@{v.username} (Admin) has banned you for **{days_txt}** days."
else:
if reason: text = f"@{v.username} has banned you permanently for the following reason:\n\n> {reason}"
else: text = f"@{v.username} has banned you permanently."
if reason: text = f"@{v.username} (Admin) has banned you permanently for the following reason:\n\n> {reason}"
else: text = f"@{v.username} (Admin) has banned you permanently."
send_repeatable_notification(user.id, text)
@ -1068,11 +1068,11 @@ def unban_user(user_id, v):
user.is_banned = 0
user.unban_utc = 0
user.ban_reason = None
send_repeatable_notification(user.id, f"@{v.username} has unbanned you!")
send_repeatable_notification(user.id, f"@{v.username} (Admin) has unbanned you!")
g.db.add(user)
for x in user.alts:
if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} has unbanned you!")
if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} (Admin) has unbanned you!")
x.is_banned = 0
x.unban_utc = 0
x.ban_reason = None
@ -1235,7 +1235,7 @@ def sticky_post(post_id, v):
g.db.add(ma)
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} has pinned [{post.title}](/post/{post_id})!")
send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has pinned [{post.title}](/post/{post_id})!")
cache.delete_memoized(frontlist)
return {"message": "Post pinned!"}
@ -1260,7 +1260,7 @@ def unsticky_post(post_id, v):
g.db.add(ma)
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} has unpinned [{post.title}](/post/{post_id})!")
send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has unpinned [{post.title}](/post/{post_id})!")
cache.delete_memoized(frontlist)
return {"message": "Post unpinned!"}
@ -1283,7 +1283,7 @@ def sticky_comment(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
message = f"@{v.username} has pinned your [comment]({comment.shortlink})!"
message = f"@{v.username} (Admin) has pinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment pinned!"}
@ -1309,7 +1309,7 @@ def unsticky_comment(cid, v):
g.db.add(ma)
if v.id != comment.author_id:
message = f"@{v.username} has unpinned your [comment]({comment.shortlink})!"
message = f"@{v.username} (Admin) has unpinned your [comment]({comment.shortlink})!"
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment unpinned!"}

View File

@ -147,11 +147,11 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.co'):
author.coins += 250
g.db.add(author)
msg = f"@{v.username} has approved a marsey you made: :{marsey.name}:\nYou have received 250 coins as a reward!"
msg = f"@{v.username} (Admin) has approved a marsey you made: :{marsey.name}:\nYou have received 250 coins as a reward!"
send_repeatable_notification(author.id, msg)
if v.id not in (author.id, marsey.submitter_id):
msg = f"@{v.username} has approved a marsey you submitted: :{marsey.name}:"
msg = f"@{v.username} (Admin) has approved a marsey you submitted: :{marsey.name}:"
send_repeatable_notification(marsey.submitter_id, msg)
marsey.submitter_id = None
@ -306,7 +306,7 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.co'):
if v.id != hat.submitter_id:
msg = f"@{v.username} has approved a hat you submitted: '{hat.name}'"
msg = f"@{v.username} (Admin) has approved a hat you submitted: '{hat.name}'"
send_repeatable_notification(hat.submitter_id, msg)
hat.submitter_id = None

View File

@ -158,7 +158,7 @@ def admin_app_approve(v, aid):
g.db.add(new_auth)
send_repeatable_notification(user.id, f"@{v.username} has approved your application `{app.app_name}`. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next, and join this [discord server](/discord) if you need help!")
send_repeatable_notification(user.id, f"@{v.username} (Admin) has approved your application `{app.app_name}`. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next, and join this [discord server](/discord) if you need help!")
ma = ModAction(
kind="approve_app",
@ -181,7 +181,7 @@ def admin_app_revoke(v, aid):
for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth)
if v.id != app.author.id:
send_repeatable_notification(app.author.id, f"@{v.username} has revoked your application `{app.app_name}`.")
send_repeatable_notification(app.author.id, f"@{v.username} (Admin) has revoked your application `{app.app_name}`.")
g.db.delete(app)
@ -207,7 +207,7 @@ def admin_app_reject(v, aid):
for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth)
if v.id != app.author.id:
send_repeatable_notification(app.author.id, f"@{v.username} has rejected your application `{app.app_name}`.")
send_repeatable_notification(app.author.id, f"@{v.username} (Admin) has rejected your application `{app.app_name}`.")
g.db.delete(app)

View File

@ -49,7 +49,7 @@ def club_post(pid, v):
)
g.db.add(ma)
message = f"@{v.username} (admin) has moved [{post.title}]({post.shortlink}) to the {CC_TITLE}!"
message = f"@{v.username} (Admin) has moved [{post.title}]({post.shortlink}) to the {CC_TITLE}!"
send_repeatable_notification(post.author_id, message)
return {"message": f"Post has been moved to the {CC_TITLE}!"}
@ -75,7 +75,7 @@ def unclub_post(pid, v):
)
g.db.add(ma)
message = f"@{v.username} (admin) has removed [{post.title}]({post.shortlink}) from the {CC_TITLE}!"
message = f"@{v.username} (Admin) has removed [{post.title}]({post.shortlink}) from the {CC_TITLE}!"
send_repeatable_notification(post.author_id, message)
return {"message": f"Post has been removed from the {CC_TITLE}!"}

View File

@ -586,7 +586,7 @@ if SITE == 'pcmemes.net':
g.db.add(streamer)
g.db.flush()
if v.id != KIPPY_ID:
send_repeatable_notification(KIPPY_ID, f"@{v.username} has added a [new YouTube channel](https://www.youtube.com/channel/{streamer.id})")
send_repeatable_notification(KIPPY_ID, f"@{v.username} (Admin) has added a [new YouTube channel](https://www.youtube.com/channel/{streamer.id})")
processed = process_streamer(id)
if processed:
@ -609,7 +609,7 @@ if SITE == 'pcmemes.net':
streamer = g.db.get(Streamer, id)
if streamer:
if v.id != KIPPY_ID:
send_repeatable_notification(KIPPY_ID, f"@{v.username} has removed a [YouTube channel](https://www.youtube.com/channel/{streamer.id})")
send_repeatable_notification(KIPPY_ID, f"@{v.username} (Admin) has removed a [YouTube channel](https://www.youtube.com/channel/{streamer.id})")
g.db.delete(streamer)
live = cache.get('live') or []