diff --git a/files/routes/admin.py b/files/routes/admin.py index 09336cc4f..43213a5c1 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -320,7 +320,7 @@ def revert_actions(v:User, username): user.ban_reason = None if user.is_banned: user.is_banned = 0 - send_repeatable_notification(user.id, f"@{v.username} (Admin) has unbanned you!") + send_repeatable_notification(user.id, f"@{v.username} (a site admin) has unbanned you!") g.db.add(user) for u in user.alts: @@ -329,7 +329,7 @@ def revert_actions(v:User, username): u.ban_reason = None if u.is_banned: u.is_banned = 0 - send_repeatable_notification(u.id, f"@{v.username} (Admin) has unbanned you!") + send_repeatable_notification(u.id, f"@{v.username} (a site admin) has unbanned you!") g.db.add(u) return {"message": f"@{user.username}'s admin actions have been reverted!"} @@ -567,7 +567,7 @@ def badge_grant_post(v): g.db.flush() if v.id != user.id: - 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}" + text = f"@{v.username} (a site 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( @@ -601,7 +601,7 @@ def badge_remove_post(v): return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error="User doesn't have that badge.") if v.id != user.id: - 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}" + text = f"@{v.username} (a site 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( @@ -877,7 +877,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} (Admin) has unchudded you.") + send_repeatable_notification(user.id, f"@{v.username} (a site admin) has unchudded you.") return {"message": f"@{user.username} has been unchudded!"} @@ -1003,11 +1003,11 @@ def ban_user(user_id, v): if days_txt.endswith('.0'): days_txt = days_txt[:-2] duration = f"for {days_txt} day" if days != 1: duration += "s" - 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." + if reason: text = f"@{v.username} (a site admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}" + else: text = f"@{v.username} (a site admin) has banned you for **{days_txt}** days." else: - 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." + if reason: text = f"@{v.username} (a site admin) has banned you permanently for the following reason:\n\n> {reason}" + else: text = f"@{v.username} (a site admin) has banned you permanently." send_repeatable_notification(user.id, text) @@ -1062,12 +1062,12 @@ def agendaposter(user_id, v): if days_txt.endswith('.0'): days_txt = days_txt[:-2] duration = f"for {days_txt} day" if days != 1: duration += "s" - if reason: text = f"@{v.username} (Admin) has chudded you for **{days_txt}** days for the following reason:\n\n> {reason}" - else: text = f"@{v.username} (Admin) has chudded you for **{days_txt}** days." + if reason: text = f"@{v.username} (a site admin) has chudded you for **{days_txt}** days for the following reason:\n\n> {reason}" + else: text = f"@{v.username} (a site admin) has chudded you for **{days_txt}** days." else: user.agendaposter = 1 - if reason: text = f"@{v.username} (Admin) has chudded you permanently for the following reason:\n\n> {reason}" - else: text = f"@{v.username} (Admin) has chudded you permanently." + if reason: text = f"@{v.username} (a site admin) has chudded you permanently for the following reason:\n\n> {reason}" + else: text = f"@{v.username} (a site admin) has chudded you permanently." g.db.add(user) @@ -1121,11 +1121,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} (Admin) has unbanned you!") + send_repeatable_notification(user.id, f"@{v.username} (a site 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} (Admin) has unbanned you!") + if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} (a site admin) has unbanned you!") x.is_banned = 0 x.unban_utc = 0 x.ban_reason = None @@ -1279,7 +1279,7 @@ def sticky_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} (Admin) has pinned [{post.title}](/post/{post_id})") + send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has pinned [{post.title}](/post/{post_id})") else: if pins >= PIN_LIMIT + 1: abort(403, f"Can't exceed {PIN_LIMIT} pinned posts limit!") @@ -1324,7 +1324,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} (Admin) has unpinned [{post.title}](/post/{post_id})") + send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has unpinned [{post.title}](/post/{post_id})") cache.delete_memoized(frontlist) return {"message": "Post unpinned!"} @@ -1346,7 +1346,7 @@ def sticky_comment(cid, v): g.db.add(ma) if v.id != comment.author_id: - message = f"@{v.username} (Admin) has pinned your [comment]({comment.shortlink})" + message = f"@{v.username} (a site admin) has pinned your [comment]({comment.shortlink})" send_repeatable_notification(comment.author_id, message) c = comment @@ -1377,7 +1377,7 @@ def unsticky_comment(cid, v): g.db.add(ma) if v.id != comment.author_id: - message = f"@{v.username} (Admin) has unpinned your [comment]({comment.shortlink})" + message = f"@{v.username} (a site admin) has unpinned your [comment]({comment.shortlink})" send_repeatable_notification(comment.author_id, message) cleanup = g.db.query(Comment).filter_by(stickied_child_id=comment.id).all() diff --git a/files/routes/asset_submissions.py b/files/routes/asset_submissions.py index 967e30c63..f17c4629d 100644 --- a/files/routes/asset_submissions.py +++ b/files/routes/asset_submissions.py @@ -152,11 +152,11 @@ def approve_marsey(v, name): g.db.add(author) if v.id != author.id: - msg = f"@{v.username} (Admin) has approved a marsey you made: :{marsey.name}:\nYou have received 250 coins as a reward!" + msg = f"@{v.username} (a site 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 != marsey.submitter_id and author.id != marsey.submitter_id: - msg = f"@{v.username} (Admin) has approved a marsey you submitted: :{marsey.name}:" + msg = f"@{v.username} (a site admin) has approved a marsey you submitted: :{marsey.name}:" send_repeatable_notification(marsey.submitter_id, msg) marsey.submitter_id = None @@ -307,11 +307,11 @@ def approve_hat(v, name): if v.id != author.id: - msg = f"@{v.username} (Admin) has approved a hat you made: '{hat.name}'" + msg = f"@{v.username} (a site admin) has approved a hat you made: '{hat.name}'" send_repeatable_notification(author.id, msg) if v.id != hat.submitter_id and author.id != hat.submitter_id: - msg = f"@{v.username} (Admin) has approved a hat you submitted: '{hat.name}'" + msg = f"@{v.username} (a site admin) has approved a hat you submitted: '{hat.name}'" send_repeatable_notification(hat.submitter_id, msg) hat.submitter_id = None diff --git a/files/routes/login.py b/files/routes/login.py index cd288772a..49a92350f 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -115,7 +115,7 @@ def login_post(v:Optional[User]): def log_failed_admin_login_attempt(account:User, type:str): if not account or account.admin_level < PERMS['SITE_WARN_ON_INVALID_AUTH']: return ip = get_CF() - print(f"Admin user from {ip} failed to login to account @{account.user_name} (invalid {type})") + print(f"A site admin from {ip} failed to login to account @{account.user_name} (invalid {type})") t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())) log_file(f"{t}, {ip}, {account.username}, {type}", "admin_failed_logins.log") diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 50432ef9d..7898000e6 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -156,7 +156,7 @@ def admin_app_approve(v, aid): g.db.add(new_auth) - 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!") + send_repeatable_notification(user.id, f"@{v.username} (a site 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!") ma = ModAction( kind="approve_app", @@ -179,7 +179,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} (Admin) has revoked your application `{app.app_name}`.") + send_repeatable_notification(app.author.id, f"@{v.username} (a site admin) has revoked your application `{app.app_name}`.") g.db.delete(app) @@ -205,7 +205,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} (Admin) has rejected your application `{app.app_name}`.") + send_repeatable_notification(app.author.id, f"@{v.username} (a site admin) has rejected your application `{app.app_name}`.") g.db.delete(app) diff --git a/files/routes/posts.py b/files/routes/posts.py index baa08b93b..95d2801ec 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -908,7 +908,7 @@ def mark_post_nsfw(pid, v): target_submission_id = post.id, ) g.db.add(ma) - send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has marked [{post.title}](/post/{post.id}) as +18") + send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has marked [{post.title}](/post/{post.id}) as +18") return {"message": "Post has been marked as +18!"} @@ -942,7 +942,7 @@ def unmark_post_nsfw(pid, v): target_submission_id = post.id, ) g.db.add(ma) - send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has unmarked [{post.title}](/post/{post.id}) as +18") + send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has unmarked [{post.title}](/post/{post.id}) as +18") return {"message": "Post has been unmarked as +18!"} @@ -1006,7 +1006,7 @@ def set_new_sort(post_id:int, v:User): target_submission_id = post.id, ) g.db.add(ma) - send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has changed the the default sorting of comments on [{post.title}](/post/{post.id}) to `new`") + send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has changed the the default sorting of comments on [{post.title}](/post/{post.id}) to `new`") return {"message": f"Changed the the default sorting of comments on this post to 'new'"} @@ -1027,7 +1027,7 @@ def unset_new_sort(post_id:int, v:User): target_submission_id = post.id, ) g.db.add(ma) - send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has changed the the default sorting of comments on [{post.title}](/post/{post.id}) to `hot`") + send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has changed the the default sorting of comments on [{post.title}](/post/{post.id}) to `hot`") return {"message": f"Changed the the default sorting of comments on this post to 'hot'"} diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 84a919d74..08f36ddf4 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -37,7 +37,7 @@ def flag_post(pid, v): _note=f'"{post.flair}"' ) g.db.add(ma) - position = 'Admin' + position = 'a site admin' else: ma = SubAction( sub=post.sub, @@ -47,7 +47,7 @@ def flag_post(pid, v): _note=f'"{post.flair}"' ) g.db.add(ma) - position = f'/h/{post.sub} Mod' + position = f'a /h/{post.sub} mod' if v.id != post.author_id: message = f'@{v.username} ({position}) has flaired [{post.title}]({post.shortlink}) with the flair: `"{og_flair}"`' @@ -184,9 +184,20 @@ def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]: ) g.db.add(ma) - if v.admin_level >= PERMS['POST_COMMENT_MODERATION']: position = 'Admin' - else: position = f'/h/{sub_from} Mod' - message = f"@{v.username} ({position}) has moved [{post.title}]({post.shortlink}) to /h/{post.sub}" + if v.admin_level >= PERMS['POST_COMMENT_MODERATION']: position = 'a site admin' + else: position = f'a /h/{sub_from} mod' + + if post.sub == None: + sub_to_in_notif = 'the main feed' + else: + sub_to_in_notif = f'/h/{post.sub}' + + if sub_from == None: + sub_from_in_notif = 'the main feed' + else: + sub_from_in_notif = f'/h/{sub_from}' + + message = f"@{v.username} ({position}) has moved [{post.title}]({post.shortlink}) from {sub_from_in_notif} to {sub_to_in_notif}" send_repeatable_notification(post.author_id, message) cache.delete_memoized(frontlist) diff --git a/files/routes/streamers.py b/files/routes/streamers.py index be7845294..2774543bb 100644 --- a/files/routes/streamers.py +++ b/files/routes/streamers.py @@ -136,7 +136,7 @@ def live_add(v): g.db.add(streamer) g.db.flush() if v.id != KIPPY_ID: - send_repeatable_notification(KIPPY_ID, f"@{v.username} (Admin) has added a [new YouTube channel](https://www.youtube.com/channel/{streamer.id})") + send_repeatable_notification(KIPPY_ID, f"@{v.username} (a site admin) has added a [new YouTube channel](https://www.youtube.com/channel/{streamer.id})") processed = process_streamer(id) if processed: @@ -159,7 +159,7 @@ def live_remove(v): streamer = g.db.get(Streamer, id) if streamer: if v.id != KIPPY_ID: - send_repeatable_notification(KIPPY_ID, f"@{v.username} (Admin) has removed a [YouTube channel](https://www.youtube.com/channel/{streamer.id})") + send_repeatable_notification(KIPPY_ID, f"@{v.username} (a site admin) has removed a [YouTube channel](https://www.youtube.com/channel/{streamer.id})") g.db.delete(streamer) live = cache.get('live') or [] @@ -171,4 +171,4 @@ def live_remove(v): if live: cache.set('live', live) if offline: cache.set('offline', offline) - return redirect('/live') \ No newline at end of file + return redirect('/live') diff --git a/files/routes/subs.py b/files/routes/subs.py index d0a0bfcc1..936ad91de 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -363,7 +363,7 @@ def kick(v:User, pid): g.db.add(ma) if v.id != post.author_id: - message = f"@{v.username} (/h/{old} Mod) has moved [{post.title}]({post.shortlink}) from /h/{old} to the main feed!" + message = f"@{v.username} (a /h/{old} mod) has moved [{post.title}]({post.shortlink}) from /h/{old} to the main feed!" send_repeatable_notification(post.author_id, message) g.db.add(post) @@ -614,7 +614,7 @@ def hole_pin(v:User, pid): g.db.add(p) if v.id != p.author_id: - message = f"@{v.username} (/h/{p.sub} Mod) has pinned [{p.title}]({p.shortlink}) in /h/{p.sub}" + message = f"@{v.username} (a /h/{p.sub} mod) has pinned [{p.title}]({p.shortlink}) in /h/{p.sub}" send_repeatable_notification(p.author_id, message) ma = SubAction( @@ -640,7 +640,7 @@ def hole_unpin(v:User, pid): g.db.add(p) if v.id != p.author_id: - message = f"@{v.username} (/h/{p.sub} Mod) has unpinned [{p.title}]({p.shortlink}) in /h/{p.sub}" + message = f"@{v.username} (a /h/{p.sub} mod) has unpinned [{p.title}]({p.shortlink}) in /h/{p.sub}" send_repeatable_notification(p.author_id, message) ma = SubAction( @@ -707,7 +707,7 @@ def mod_pin(cid, v): g.db.add(ma) if v.id != comment.author_id: - message = f"@{v.username} (/h/{comment.post.sub} Mod) has pinned your [comment]({comment.shortlink})" + message = f"@{v.username} (a /h/{comment.post.sub} mod) has pinned your [comment]({comment.shortlink})" send_repeatable_notification(comment.author_id, message) return {"message": "Comment pinned!"} @@ -733,7 +733,7 @@ def mod_unpin(cid, v): g.db.add(ma) if v.id != comment.author_id: - message = f"@{v.username} (/h/{comment.post.sub} Mod) has unpinned your [comment]({comment.shortlink})" + message = f"@{v.username} (a /h/{comment.post.sub} mod) has unpinned your [comment]({comment.shortlink})" send_repeatable_notification(comment.author_id, message) return {"message": "Comment unpinned!"}