From 633a7131e373855c5c07cf5af45ad102ef12ba83 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 2 Jan 2022 20:25:24 +0200 Subject: [PATCH] fdsfs --- files/classes/mod_logs.py | 141 +++----------------------------------- files/routes/awards.py | 18 ++++- 2 files changed, 25 insertions(+), 134 deletions(-) diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 04c312f70b..8d285a5ba1 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -4,6 +4,7 @@ from files.__main__ import Base import time from files.helpers.lazy import lazy from os import environ +from copy import deepcopy site = environ.get("DOMAIN").strip() if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" @@ -113,6 +114,11 @@ class ModAction(Base): return f"/log/{self.id}" ACTIONTYPES={ + "grant_awards": { + "str": "granted awards to {self.target_link}", + "icon": "fa-user", + "color": "bg-muted", + }, "check": { "str": "gave {self.target_link} a checkmark", "icon": "fa-user", @@ -260,135 +266,6 @@ ACTIONTYPES={ }, } -ACTIONTYPES2={ - "uncheck": { - "str": "removed checkmark from {self.target_link}", - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "ban_domain": { - "str": "banned a domain", - "icon": "fa-globe", - "color": "bg-danger", - }, - "unban_domain": { - "str": "unbanned a domain", - "icon": "fa-globe", - "color": "bg-muted", - }, - "approve_app": { - "str": "approved an application by {self.target_link}", - "icon": "fa-robot", - "color": "bg-muted", - }, - "revoke_app": { - "str": "revoked an application by {self.target_link}", - "icon": "fa-robot", - "color": "bg-danger", - }, - "reject_app": { - "str": "rejected an application request by {self.target_link}", - "icon": "fa-robot", - "color": "bg-danger", - }, - "change_rules": { - "str": "changed the rules", - "icon": "fa-balance-scale", - "color": "bg-muted", - }, - "change_sidebar": { - "str": "changed the sidebar", - "icon": "fa-columns", - "color": "bg-muted", - }, - "ban_user":{ - "str":'banned user {self.target_link}', - "icon":"fa-user-slash", - "color": "bg-danger", - }, - "unban_user":{ - "str":'unbanned user {self.target_link}', - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "nuke_user":{ - "str":'removed all content of {self.target_link}', - "icon":"fa-user-slash", - "color": "bg-danger", - }, - "unnuke_user":{ - "str":'approved all content of {self.target_link}', - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "agendaposter": { - "str": "set agendaposter theme on {self.target_link}", - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "unagendaposter": { - "str": "removed agendaposter theme from {self.target_link}", - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "set_flair_locked":{ - "str":"set {self.target_link}'s flair (locked)", - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "set_flair_notlocked":{ - "str":"set {self.target_link}'s flair (not locked)", - "icon": "fa-user-slash", - "color": "bg-muted", - }, - "pin_comment":{ - "str":'pinned a {self.target_link}', - "icon":"fa-thumbtack fa-rotate--45", - "color": "bg-info", - }, - "unpin_comment":{ - "str":'un-pinned a {self.target_link}', - "icon":"fa-thumbtack fa-rotate--45", - "color": "bg-muted", - }, - "pin_post":{ - "str":'pinned post {self.target_link}', - "icon":"fa-thumbtack fa-rotate--45", - "color": "bg-success", - }, - "unpin_post":{ - "str":'un-pinned post {self.target_link}', - "icon":"fa-thumbtack fa-rotate--45", - "color": "bg-muted", - }, - "set_nsfw":{ - "str":'set nsfw on post {self.target_link}', - "icon":"fa-eye-evil", - "color": "bg-danger", - }, - "unset_nsfw":{ - "str":'un-set nsfw on post {self.target_link}', - "icon":"fa-eye-evil", - "color": "bg-muted", - }, - "ban_post":{ - "str": 'removed post {self.target_link}', - "icon":"fa-feather-alt", - "color": "bg-danger", - }, - "unban_post":{ - "str": 'reinstated post {self.target_link}', - "icon":"fa-feather-alt", - "color": "bg-muted", - }, - "ban_comment":{ - "str": 'removed {self.target_link}', - "icon":"fa-comment", - "color": "bg-danger", - }, - "unban_comment":{ - "str": 'reinstated {self.target_link}', - "icon":"fa-comment", - "color": "bg-muted", - }, -} \ No newline at end of file +ACTIONTYPES2 = deepcopy(ACTIONTYPES) +ACTIONTYPES2.pop("shadowban") +ACTIONTYPES2.pop("unshadowban") \ No newline at end of file diff --git a/files/routes/awards.py b/files/routes/awards.py index 9f86986da6..32192cddef 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -555,11 +555,25 @@ def admin_userawards_post(v): g.db.add(award) text = "You were given the following awards:\n\n" - - for key, value in notify_awards.items(): text += f" - **{value}** {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}\n" + + for key, value in notify_awards.items(): + text += f" - **{value}** {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}\n" send_repeatable_notification(u.id, text) + note = "" + + for key, value in notify_awards.items(): + note += f"{value} {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}, " + + ma=ModAction( + kind="grant_awards", + user_id=v.id, + target_user_id=u.id, + _note=note + ) + g.db.add(ma) + g.db.commit() if v.admin_level != 3: return render_template(f"{template}admin/awards.html", awards=list(AWARDS3.values()), v=v)